module RSolr::Pagination

Public Class Methods

calculate_start_and_rows(page, per_page) click to toggle source

Calculates the "start" and "rows" Solr params by inspecting the :per_page and :page params.

# 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