Class: Gummi::Document::Search::Result
- Inherits:
-
Object
- Object
- Gummi::Document::Search::Result
- Defined in:
- lib/gummi/document/search/result.rb
Instance Attribute Summary collapse
-
#facets ⇒ Object
readonly
Returns the value of attribute facets.
-
#hits ⇒ Object
readonly
Returns the value of attribute hits.
-
#took ⇒ Object
readonly
Returns the value of attribute took.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(result) ⇒ Result
constructor
A new instance of Result.
- #records ⇒ Object
Constructor Details
#initialize(result) ⇒ Result
8 9 10 11 12 13 |
# File 'lib/gummi/document/search/result.rb', line 8 def initialize(result) @took = result["took"] @total = result["hits"]["total"] @hits = result["hits"]["hits"] @facets = result["facets"] end |
Instance Attribute Details
#facets ⇒ Object (readonly)
Returns the value of attribute facets.
6 7 8 |
# File 'lib/gummi/document/search/result.rb', line 6 def facets @facets end |
#hits ⇒ Object (readonly)
Returns the value of attribute hits.
6 7 8 |
# File 'lib/gummi/document/search/result.rb', line 6 def hits @hits end |
#took ⇒ Object (readonly)
Returns the value of attribute took.
6 7 8 |
# File 'lib/gummi/document/search/result.rb', line 6 def took @took end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
6 7 8 |
# File 'lib/gummi/document/search/result.rb', line 6 def total @total end |
Instance Method Details
#records ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/gummi/document/search/result.rb', line 15 def records hits.map do |hit| model = "DB::#{hit["_type"].humanize}".constantize doc_hash = {id: hit["_id"]}.merge(hit["_source"]) model.new(doc_hash) end end |