Module: Sunspot::DSL::Paginatable
- Included in:
- MoreLikeThisQuery, StandardQuery
- Defined in:
- sunspot/lib/sunspot/dsl/paginatable.rb
Instance Method Summary (collapse)
-
- (Object) paginate(options = {})
Paginate your search.
Instance Method Details
- (Object) paginate(options = {})
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 | The requested page. The default is 1. |
:per_page | How many results to return per page. The default is the value in Sunspot.config.pagination.default_per_page |
:offset | Applies a shift to paginated records. The default is 0. |
23 24 25 26 27 28 29 |
# File 'sunspot/lib/sunspot/dsl/paginatable.rb', line 23 def paginate( = {}) page = .delete(:page) per_page = .delete(:per_page) offset = .delete(:offset) raise ArgumentError, "unknown argument #{.keys.first.inspect} passed to paginate" unless .empty? @query.paginate(page, per_page, offset) end |