Class: Sunspot::FacetData::FieldFacetData
- Defined in:
- lib/sunspot/facet_data.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#initialize(facet_values, field) ⇒ FieldFacetData
constructor
:nodoc:.
-
#name ⇒ Object
The name of the field that contains this facet’s values.
-
#rows ⇒ Object
The rows returned for this facet.
Methods inherited from Abstract
Constructor Details
#initialize(facet_values, field) ⇒ FieldFacetData
:nodoc:
26 27 28 |
# File 'lib/sunspot/facet_data.rb', line 26 def initialize(facet_values, field) #:nodoc: @facet_values, @field = facet_values, field end |
Instance Method Details
#name ⇒ Object
The name of the field that contains this facet’s values
Returns
- Symbol
-
The field name
36 37 38 |
# File 'lib/sunspot/facet_data.rb', line 36 def name @field.name end |
#rows ⇒ Object
The rows returned for this facet.
Returns
- Array
-
Collection of FacetRow objects, in the order returned by Solr
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/sunspot/facet_data.rb', line 46 def rows @rows ||= begin rows = [] @facet_values.each_slice(2) do |value, count| rows << yield(row_value(value), count) end rows end end |