Class: Elastify::Helpers::ElasticSearch::SearchResult
- Inherits:
-
Object
- Object
- Elastify::Helpers::ElasticSearch::SearchResult
- Defined in:
- lib/elastify/helpers/elastic_search/search_result.rb
Instance Attribute Summary collapse
-
#elastify_options ⇒ Object
Returns the value of attribute elastify_options.
-
#id ⇒ Object
Returns the value of attribute id.
-
#index ⇒ Object
Returns the value of attribute index.
-
#score ⇒ Object
Returns the value of attribute score.
-
#source ⇒ Object
Returns the value of attribute source.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #decode ⇒ Object
-
#initialize(elasticsearch_search_result_hit, elastify_options) ⇒ SearchResult
constructor
A new instance of SearchResult.
Constructor Details
#initialize(elasticsearch_search_result_hit, elastify_options) ⇒ SearchResult
Returns a new instance of SearchResult.
8 9 10 11 12 13 14 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 8 def initialize(elasticsearch_search_result_hit, ) @index = elasticsearch_search_result_hit["_index"] @type = elasticsearch_search_result_hit["_type"] @id = elasticsearch_search_result_hit["_id"] @source = elasticsearch_search_result_hit["_source"] @elastify_options = end |
Instance Attribute Details
#elastify_options ⇒ Object
Returns the value of attribute elastify_options.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 5 def @elastify_options end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 5 def id @id end |
#index ⇒ Object
Returns the value of attribute index.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 5 def index @index end |
#score ⇒ Object
Returns the value of attribute score.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 5 def score @score end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 5 def source @source end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 5 def type @type end |
Instance Method Details
#decode ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/elastify/helpers/elastic_search/search_result.rb', line 16 def decode data = {} if @elastify_options[:decode] data = @elastify_options[:decode].call(@source) end return data end |