Module: Sunspot::DSL::Paginatable
- Included in:
- MoreLikeThisQuery, StandardQuery
- Defined in:
- lib/sunspot/dsl/paginatable.rb
Instance Method Summary collapse
-
#paginate(options = {}) ⇒ Object
Paginate your search.
Instance Method Details
#paginate(options = {}) ⇒ Object
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
20 21 22 23 24 25 |
# File 'lib/sunspot/dsl/paginatable.rb', line 20 def paginate( = {}) page = .delete(:page) per_page = .delete(:per_page) raise ArgumentError, "unknown argument #{.keys.first.inspect} passed to paginate" unless .empty? @query.paginate(page, per_page) end |