Module: Flex::Result::Search
- Defined in:
- lib/flex/result/search.rb
Class Method Summary collapse
-
.extended(result) ⇒ Object
extend the hits results on extended.
-
.should_extend?(result) ⇒ Boolean
extend if result comes from a search url.
Instance Method Summary collapse
- #collection ⇒ Object (also: #documents)
- #facets ⇒ Object
Class Method Details
.extended(result) ⇒ Object
extend the hits results on extended
11 12 13 14 15 |
# File 'lib/flex/result/search.rb', line 11 def self.extended(result) result['hits']['hits'].each { |h| h.extend(Document) } result['hits']['hits'].extend Struct::Paginable result['hits']['hits'].setup(result['hits']['total'], result.variables) end |
.should_extend?(result) ⇒ Boolean
extend if result comes from a search url
6 7 8 |
# File 'lib/flex/result/search.rb', line 6 def self.should_extend?(result) result.response.url =~ /\b_m?search\b/ && result['hits'] end |
Instance Method Details
#collection ⇒ Object Also known as: documents
17 18 19 |
# File 'lib/flex/result/search.rb', line 17 def collection self['hits']['hits'] end |
#facets ⇒ Object
22 23 24 |
# File 'lib/flex/result/search.rb', line 22 def facets self['facets'] end |