I'm having trouble paginating search results for jobs with Elasticsearch, Tire, and Kaminari.
I am looking for all the models in my application (news, pictures, books) as a general search on the site and, therefore, you need a block for searching tires, in my site controller for finer-grained control, for example, showing more than 10 entries by default :
class SiteController < ApplicationController def search # @results = Painting.search(params[:query]) query = params[:query] @results = Tire.search ['news','paintings', 'books'], :page => (params[:page]||1), :per_page=> (params[:per_page] || 3) do query { string query } size 100 end end end
On my search results page, I have the following code:
- if @results - @results.results.each do |result| = result.title
and in all my models I have the correct display and includes tires:
# - - - - - - - - - - - - - - - -
I ensured that all my records are indexed properly in Elasticsearch.
The problem I am facing is that I cannot get it to work, the last error is:
undefined method `current_page '
Any thoughts would be greatly appreciated. Thanks.