Class: Sunspot::Search::JsonFacetRow
- Inherits:
-
Object
- Object
- Sunspot::Search::JsonFacetRow
- Defined in:
- lib/sunspot/search/json_facet_row.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#instance ⇒ Object
Return the instance referenced by this facet row.
-
#nested ⇒ Object
readonly
Returns the value of attribute nested.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(data, facet) ⇒ JsonFacetRow
constructor
:nodoc:.
- #inspect ⇒ Object
Constructor Details
#initialize(data, facet) ⇒ JsonFacetRow
:nodoc:
7 8 9 10 11 12 13 |
# File 'lib/sunspot/search/json_facet_row.rb', line 7 def initialize(data, facet) #:nodoc: @value = data['val'] @count = data['distinct'] || data['count'] @facet = facet @nested_key = data.keys.select { |k| data[k].is_a?(Hash) }.first @nested = recursive_nested_initialization(data) unless @nested_key.nil? end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
4 5 6 |
# File 'lib/sunspot/search/json_facet_row.rb', line 4 def count @count end |
#instance ⇒ Object
Return the instance referenced by this facet row. Only valid for field facets whose fields are defined with the :references key.
19 20 21 22 23 24 |
# File 'lib/sunspot/search/json_facet_row.rb', line 19 def instance if !defined?(@instance) @facet.populate_instances end @instance end |
#nested ⇒ Object (readonly)
Returns the value of attribute nested.
4 5 6 |
# File 'lib/sunspot/search/json_facet_row.rb', line 4 def nested @nested end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/sunspot/search/json_facet_row.rb', line 4 def value @value end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/sunspot/search/json_facet_row.rb', line 26 def inspect "<Sunspot::Search::FacetRow:#{value.inspect} (#{count}) #{nested.nil? ? '' : " nested_count=#{nested.size}"}>" end |