Sha256: 39be37b383d675e2445b629d879aa4e2909f3229bafceacd5b7d8741744abbbd
Contents?: true
Size: 737 Bytes
Versions: 3
Compression:
Stored size: 737 Bytes
Contents
module Sunspot module Query # # A FieldStat stats by the unique values of a given field. # class FieldStat def initialize(field, options = {}) if field.multiple? raise(ArgumentError, "#{field.name} cannot be used for stats because it is a multiple-value field") end @field = field @options = options @sort = SortComposite.new end def add_sort(sort) @sort << sort end def to_params params = { :stats => 'true', :"stats.field" => @field.indexed_name } params.merge!({:"stats.facet" => @options[:facet].indexed_name}) if !@options[:facet].nil? params end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
sunspot_stat-1.0.0 | lib/query/field_stat.rb |
sunspot_stats-0.0.7 | lib/query/field_stat.rb |
sunspot_stats-0.0.6 | lib/query/field_stat.rb |