Sha256: 278e05e672759179620e46af2f2eef631a1ef9a973543d9e79b85394cc131df0
Contents?: true
Size: 1.17 KB
Versions: 11
Compression:
Stored size: 1.17 KB
Contents
module Sunspot module Search class StatsRow attr_reader :data, :value attr_writer :instance #:nodoc: def initialize(data, facet = nil, value = nil) #:nodoc: @data, @facet, @value = data, facet, value @facet_fields = [] end def min data['min'] end def max data['max'] end def count data['count'] end def sum data['sum'] end def missing data['missing'] end def sum_of_squares data['sumOfSquares'] end def mean data['mean'] end def standard_deviation data['stddev'] end def facet name facets.find { |facet| facet.field.name == name.to_sym } end def facets @facets ||= @facet_fields.map do |field| StatsFacet.new(field, data['facets'][field.indexed_name]) end end def instance if !defined?(@instance) @facet.populate_instances end @instance end def inspect "<Sunspot::Search::StatsRow:#{value.inspect} min=#{min} max=#{max} count=#{count}>" end end end end
Version data entries
11 entries across 11 versions & 2 rubygems