Module: Elasticsearch::FacetedSearch::Pagination
- Included in:
- FacetBase
- Defined in:
- lib/elasticsearch/faceted_search/pagination.rb
Instance Method Summary collapse
- #current_page ⇒ Object
- #limit ⇒ Object
- #limit_value ⇒ Object
- #total_count ⇒ Object
- #total_pages ⇒ Object
Instance Method Details
#current_page ⇒ Object
22 23 24 |
# File 'lib/elasticsearch/faceted_search/pagination.rb', line 22 def current_page (search_params[:page] ||= 1).to_i end |
#limit ⇒ Object
18 19 20 |
# File 'lib/elasticsearch/faceted_search/pagination.rb', line 18 def limit (search_params[:limit] ||= 32).to_i end |
#limit_value ⇒ Object
14 15 16 |
# File 'lib/elasticsearch/faceted_search/pagination.rb', line 14 def limit_value limit end |
#total_count ⇒ Object
4 5 6 7 8 |
# File 'lib/elasticsearch/faceted_search/pagination.rb', line 4 def total_count search['hits']['total'].to_i rescue 0 end |
#total_pages ⇒ Object
10 11 12 |
# File 'lib/elasticsearch/faceted_search/pagination.rb', line 10 def total_pages (total_count.to_f / limit_value.to_f).ceil end |