Sha256: e9a239d3cd44fa6899a965d436365638bb5ba327d218f3065225bab8ba727b6a
Contents?: true
Size: 778 Bytes
Versions: 64
Compression:
Stored size: 778 Bytes
Contents
module Sunspot module Query # # The SortComposite class encapsulates an ordered collection of Sort # objects. It's necessary to keep this as a separate class as Solr takes # the sort as a single parameter, so adding sorts as regular components # would not merge correctly in the #to_params method. # class SortComposite #:nodoc: def initialize @sorts = [] end # # Add a sort to the composite # def <<(sort) @sorts << sort end # # Combine the sorts into a single param by joining them # def to_params unless @sorts.empty? { :sort => @sorts.map { |sort| sort.to_param } * ', ' } else {} end end end end end
Version data entries
64 entries across 64 versions & 15 rubygems