class Sunspot::Search::StatsJsonRow
Attributes
data[R]
nested[R]
value[R]
Public Instance Methods
count()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 22 def count data['count'] end
facet(name)
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 48 def facet name facets.find { |facet| facet.field.name == name.to_sym } end
facets()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 52 def facets @facets ||= @facet_fields.map do |field| StatsFacet.new(field, data['facets'][field.indexed_name]) end end
inspect()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 65 def inspect "<Sunspot::Search::StatsJsonRow:#{value.inspect} min=#{min} max=#{max}"\ " count=#{count} sum=#{sum} missing=#{missing} sum_of_squares=#{sum_of_squares}"\ " mean=#{mean} standard_deviation=#{standard_deviation}"\ " #{nested.nil? ? '' : "nested_count=#{nested.size}"}>" end
instance()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 58 def instance if !defined?(@instance) @facet.populate_instances end @instance end
max()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 18 def max data['max'] end
mean()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 39 def mean data['avg'] end
Also aliased as: avg
min()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 14 def min data['min'] end
missing()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 30 def missing data['missing'] end
standard_deviation()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 44 def standard_deviation data['stddev'] end
sum()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 26 def sum data['sum'] end
sum_of_squares()
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 34 def sum_of_squares data['sumsq'] end
Also aliased as: sumsq
Private Instance Methods
recursive_nested_initialization(data)
click to toggle source
# File lib/sunspot/search/stats_json_row.rb, line 74 def recursive_nested_initialization(data) data[@nested_key]['buckets'].map do |d| StatsJsonRow.new(d, @facet, d['val']) end end