Sha256: c6c6ddfd18361273c1b43626095eecff0f15076ea0909bb20229427aa7a2bbad

Contents?: true

Size: 1.1 KB

Versions: 28

Compression:

Stored size: 1.1 KB

Contents

module Sunspot
  module DSL #:nodoc
    module Paginatable
      # Paginate your search. This works the same way as WillPaginate's
      # paginate().
      #
      # Note that Solr searches are _always_ paginated. Not calling #paginate is
      # the equivalent of calling:
      #
      #   paginate(:page => 1, :per_page => Sunspot.config.pagination.default_per_page)
      #
      # ==== Options (options)
      #
      # :page<Integer,String>:: The requested page. The default is 1.
      #
      # :per_page<Integer,String>::
      #   How many results to return per page. The default is the value in
      #   +Sunspot.config.pagination.default_per_page+
      #
      # :offset<Integer,String>::
      #   Applies a shift to paginated records. The default is 0.
      #
      def paginate(options = {})
        page = options.delete(:page)
        per_page = options.delete(:per_page)
        offset = options.delete(:offset)
        raise ArgumentError, "unknown argument #{options.keys.first.inspect} passed to paginate" unless options.empty?
        @query.paginate(page, per_page, offset)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 6 rubygems

Version Path
sunspot-2.1.1 lib/sunspot/dsl/paginatable.rb
sunspot-2.1.0 lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0 lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0.pre.130115 lib/sunspot/dsl/paginatable.rb
gojee-sunspot-2.0.5 lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0.pre.120925 lib/sunspot/dsl/paginatable.rb
sunspot_solr-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/paginatable.rb
sunspot_rails-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/paginatable.rb
gojee-sunspot-2.0.4 lib/sunspot/dsl/paginatable.rb
gojee-sunspot-2.0.2 lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0.pre.120720 lib/sunspot/dsl/paginatable.rb
sunspot-1.3.3 lib/sunspot/dsl/paginatable.rb
sunspot-1.3.2 lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0.pre.120417 lib/sunspot/dsl/paginatable.rb
sunspot-2.0.0.pre.120415 lib/sunspot/dsl/paginatable.rb
sunspot-1.3.1 lib/sunspot/dsl/paginatable.rb
erichummel-sunspot-2.0.0.pre.111215d lib/sunspot/dsl/paginatable.rb
erichummel-sunspot-2.0.0.pre.111215c lib/sunspot/dsl/paginatable.rb
erichummel-sunspot-2.0.0.pre.111215b lib/sunspot/dsl/paginatable.rb