Sha256: bd99b0941d309e2d32fbc7f04534ac299f9d65571faff5448090bd97b0fc59c7
Contents?: true
Size: 1.24 KB
Versions: 16
Compression:
Stored size: 1.24 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. # # :cursor<String>:: Cursor value for cursor-based pagination. The default is nil. # def paginate(options = {}) page = options.delete(:page) per_page = options.delete(:per_page) offset = options.delete(:offset) cursor = options.delete(:cursor) raise ArgumentError, "unknown argument #{options.keys.first.inspect} passed to paginate" unless options.empty? @query.paginate(page, per_page, offset, cursor) end end end end
Version data entries
16 entries across 16 versions & 2 rubygems