module RSolr::Pagination::PaginatedDocSet
def current_page
Returns the current page calculated from 'rows' and 'start'
def current_page return 1 if start < 1 per_page_normalized = per_page < 1 ? 1 : per_page @current_page ||= (start / per_page_normalized).ceil + 1 end
def has_next?
def has_next? current_page < total_pages end
def has_previous?
def has_previous? current_page > 1 end
def next_page
returns the next page number or the last
def next_page @next_page ||= (current_page == total_pages) ? total_pages : current_page+1 end
def previous_page
returns the previous page number or 1
def previous_page @previous_page ||= (current_page > 1) ? current_page - 1 : 1 end
def total_pages
Calcuates the total pages from 'numFound' and 'rows'
def total_pages @total_pages ||= per_page > 0 ? (total / per_page.to_f).ceil : 1 end