Class: Sunspot::FacetRow
- Inherits:
-
Object
- Object
- Sunspot::FacetRow
- Defined in:
- lib/sunspot/facet_row.rb
Overview
This class encapsulates a facet row (value) for a facet.
Direct Known Subclasses
Instance Method Summary collapse
-
#count ⇒ Object
The number of documents matching the search parameters that have this value in the facet’s field.
-
#initialize(pair, facet) ⇒ FacetRow
constructor
:nodoc:.
-
#value ⇒ Object
The value associated with the facet.
Constructor Details
#initialize(pair, facet) ⇒ FacetRow
:nodoc:
4 5 6 |
# File 'lib/sunspot/facet_row.rb', line 4 def initialize(pair, facet) #:nodoc: @pair, @facet = pair, facet end |
Instance Method Details
#count ⇒ Object
The number of documents matching the search parameters that have this value in the facet’s field.
Returns
- Integer
-
Document count for this value
30 31 32 |
# File 'lib/sunspot/facet_row.rb', line 30 def count @count ||= @pair[1] end |
#value ⇒ Object
The value associated with the facet. This will be cast according to the field’s type; so, for an integer field, this method will return an integer, etc.
Note that <strong>Time fields will always return facet values in UTC</strong>.
Returns
- Object
-
The value associated with the row, cast to the appropriate type
19 20 21 |
# File 'lib/sunspot/facet_row.rb', line 19 def value @value ||= @facet.field.cast(@pair[0]) end |