Sha256: d022f529d725c6beb079663bc5fffc318c75e2ba7084570d807fe1dabcb81d29
Contents?: true
Size: 855 Bytes
Versions: 12
Compression:
Stored size: 855 Bytes
Contents
module Sunspot module Query # # A FieldGroup groups by the unique values of a given field. # class FieldGroup attr_accessor :limit, :truncate def initialize(field) if field.multiple? raise(ArgumentError, "#{field.name} cannot be used for grouping because it is a multiple-value field") end @field = field @sort = SortComposite.new end def add_sort(sort) @sort << sort end def to_params params = { :group => "true", :"group.ngroups" => "true", :"group.field" => @field.indexed_name } params.merge!(@sort.to_params("group.")) params[:"group.limit"] = @limit if @limit params[:"group.truncate"] = @truncate if @truncate params end end end end
Version data entries
12 entries across 12 versions & 3 rubygems