I’ve successfully installed Sunspot for my Ruby On Rails 3 project, but I can’t seem to find a way to get the total hits for a search query.
this is my search request
@search = Sunspot.search(Job) do
fulltext params[:job]
paginate(:page => params[:offset], :per_page => 25)
end
It works well except I need to get total number of real hits, not the total results returned (in this case 25 because of :per_page => 25)
In other words, I want to be able to display: Showing 1 to 25 out of 883 jobs found
Any help would be appreciated!
thanks
The method
totalworks here.Or, in your view, total_entries works on the results object.