Class: Sunspot::Search::Group
- Inherits:
-
Object
- Object
- Sunspot::Search::Group
- Includes:
- HitEnumerable
- Defined in:
- lib/sunspot/search/group.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #highlights_for(doc) ⇒ Object
- #hits(options = {}) ⇒ Object
-
#initialize(value, doclist, search) ⇒ Group
constructor
A new instance of Group.
- #results ⇒ Object
- #solr_docs ⇒ Object
-
#total ⇒ Object
The total number of documents matching the query for this group.
- #verified_hits ⇒ Object
Methods included from HitEnumerable
#data_accessor_for, #each_hit_with_result, #populate_hits
Constructor Details
#initialize(value, doclist, search) ⇒ Group
Returns a new instance of Group.
10 11 12 |
# File 'lib/sunspot/search/group.rb', line 10 def initialize(value, doclist, search) @value, @doclist, @search = value, doclist, search end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/sunspot/search/group.rb', line 6 def value @value end |
Instance Method Details
#highlights_for(doc) ⇒ Object
30 31 32 |
# File 'lib/sunspot/search/group.rb', line 30 def highlights_for(doc) @search.highlights_for(doc) end |
#hits(options = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/sunspot/search/group.rb', line 14 def hits( = {}) if [:verify] super else @hits ||= super end end |
#results ⇒ Object
26 27 28 |
# File 'lib/sunspot/search/group.rb', line 26 def results @results ||= verified_hits.map { |hit| hit.instance } end |
#solr_docs ⇒ Object
34 35 36 |
# File 'lib/sunspot/search/group.rb', line 34 def solr_docs @doclist['docs'] end |
#total ⇒ Object
The total number of documents matching the query for this group
Returns
- Integer
-
Total matching documents
45 46 47 |
# File 'lib/sunspot/search/group.rb', line 45 def total @doclist['numFound'] end |
#verified_hits ⇒ Object
22 23 24 |
# File 'lib/sunspot/search/group.rb', line 22 def verified_hits @verified_hits ||= super end |