Module: RSolr::Pagination
- Defined in:
- lib/rsolr/pagination.rb
Defined Under Namespace
Modules: Client, PaginatedDocSet
Class Method Summary collapse
-
.calculate_start_and_rows(page, per_page) ⇒ Object
Calculates the “start” and “rows” Solr params by inspecting the :per_page and :page params.
Class Method Details
.calculate_start_and_rows(page, per_page) ⇒ Object
Calculates the “start” and “rows” Solr params by inspecting the :per_page and :page params.
5 6 7 8 9 10 11 |
# File 'lib/rsolr/pagination.rb', line 5 def self.calculate_start_and_rows page, per_page per_page = per_page.to_s.to_i page = page.to_s.to_i-1 page = page < 1 ? 0 : page start = page * per_page [start, per_page] end |