Class: SearchFlip::Result
- Inherits:
-
Hashie::Mash
- Object
- Hashie::Mash
- SearchFlip::Result
- Defined in:
- lib/search_flip/result.rb
Overview
The SearchFlip::Result class basically is a hash wrapper that uses Hashie::Mash to provide convenient method access to the hash attributes.
Class Method Summary collapse
- .disable_warnings?(*args) ⇒ Boolean
-
.from_hit(hit) ⇒ Object
Creates a SearchFlip::Result object from a raw hit.
Class Method Details
.disable_warnings?(*args) ⇒ Boolean
6 7 8 |
# File 'lib/search_flip/result.rb', line 6 def self.disable_warnings?(*args) true end |
.from_hit(hit) ⇒ Object
Creates a SearchFlip::Result object from a raw hit. Useful for e.g. top hits aggregations.
19 20 21 22 23 24 25 26 27 |
# File 'lib/search_flip/result.rb', line 19 def self.from_hit(hit) raw_result = (hit["_source"] || {}).dup raw_result["_hit"] = hit.each_with_object({}) do |(key, value), hash| hash[key] = value if key != "_source" end new(raw_result) end |