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.
Instance Method Summary collapse
-
#count ⇒ Object
The number of documents matching the search parameters that have this value in the facet’s field.
-
#initialize(facet_value, field) ⇒ FacetRow
constructor
:nodoc:.
-
#value ⇒ Object
The value associated with the facet.
Constructor Details
#initialize(facet_value, field) ⇒ FacetRow
:nodoc:
4 5 6 |
# File 'lib/sunspot/facet_row.rb', line 4 def initialize(facet_value, field) #:nodoc: @facet_value, @field = facet_value, field 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 ||= @facet_value.value 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 ||= @field.cast(@facet_value.name) end |