Class: Elastify::Helpers::ElasticSearch::SearchResultCollection
- Inherits:
-
Object
- Object
- Elastify::Helpers::ElasticSearch::SearchResultCollection
- Defined in:
- lib/elastify/helpers/elastic_search/search_result_collection.rb
Instance Attribute Summary collapse
-
#elastify_options ⇒ Object
Returns the value of attribute elastify_options.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#hits_maxscore ⇒ Object
Returns the value of attribute hits_maxscore.
-
#hits_total ⇒ Object
Returns the value of attribute hits_total.
-
#scroll_id ⇒ Object
Returns the value of attribute scroll_id.
-
#shards_failed ⇒ Object
Returns the value of attribute shards_failed.
-
#shards_successful ⇒ Object
Returns the value of attribute shards_successful.
-
#shards_total ⇒ Object
Returns the value of attribute shards_total.
-
#timed_out ⇒ Object
Returns the value of attribute timed_out.
-
#took ⇒ Object
Returns the value of attribute took.
Instance Method Summary collapse
-
#initialize(elasticsearch_search_result, elastify_options) ⇒ SearchResultCollection
constructor
A new instance of SearchResultCollection.
Constructor Details
#initialize(elasticsearch_search_result, elastify_options) ⇒ SearchResultCollection
Returns a new instance of SearchResultCollection.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 8 def initialize(elasticsearch_search_result, ) esr = JSON.parse(elasticsearch_search_result) @scroll_id = esr["_scroll_id"] @took = esr["took"] @timed_out = esr["timed_out"] @shards_total = esr["_shards"]["total"] @shards_successful = esr["_shards"]["successful"] @shards_failed = esr["_shards"]["failed"] @hits_total = esr["hits"]["total"] @hits_maxscore = esr["hits"]["maxscore"] @hits = esr["hits"]["hits"].map{ |hit| Elastify::Helpers::ElasticSearch::SearchResult.new(hit, ) } @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_collection.rb', line 5 def @elastify_options end |
#hits ⇒ Object
Returns the value of attribute hits.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def hits @hits end |
#hits_maxscore ⇒ Object
Returns the value of attribute hits_maxscore.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def hits_maxscore @hits_maxscore end |
#hits_total ⇒ Object
Returns the value of attribute hits_total.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def hits_total @hits_total end |
#scroll_id ⇒ Object
Returns the value of attribute scroll_id.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def scroll_id @scroll_id end |
#shards_failed ⇒ Object
Returns the value of attribute shards_failed.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def shards_failed @shards_failed end |
#shards_successful ⇒ Object
Returns the value of attribute shards_successful.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def shards_successful @shards_successful end |
#shards_total ⇒ Object
Returns the value of attribute shards_total.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def shards_total @shards_total end |
#timed_out ⇒ Object
Returns the value of attribute timed_out.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def timed_out @timed_out end |
#took ⇒ Object
Returns the value of attribute took.
5 6 7 |
# File 'lib/elastify/helpers/elastic_search/search_result_collection.rb', line 5 def took @took end |