Class: ElasticSearch::Search::ResultItem

Inherits:
HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/elastic_search/search/results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hit) ⇒ ResultItem

Returns a new instance of ResultItem.



19
20
21
22
23
24
25
26
# File 'lib/elastic_search/search/results.rb', line 19

def initialize(hit)
  @index = hit['_index']
  @type = hit['_type']
  @id = hit['_id']
  @score = hit['_score']
  @explanation = hit ['_explanation']
  self.replace(hit['_source'])
end

Instance Attribute Details

#explanationObject (readonly)

Returns the value of attribute explanation.



17
18
19
# File 'lib/elastic_search/search/results.rb', line 17

def explanation
  @explanation
end

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/elastic_search/search/results.rb', line 17

def id
  @id
end

#indexObject (readonly)

Returns the value of attribute index.



17
18
19
# File 'lib/elastic_search/search/results.rb', line 17

def index
  @index
end

#scoreObject (readonly)

Returns the value of attribute score.



17
18
19
# File 'lib/elastic_search/search/results.rb', line 17

def score
  @score
end

#typeObject (readonly)

Returns the value of attribute type.



17
18
19
# File 'lib/elastic_search/search/results.rb', line 17

def type
  @type
end