Getting number of hits without pagination in sunspot 1.2 on ruby on rails 3 -


i've installed sunspot ruby on rails 3 project, can't seem find way total hits search query.

this search request

@search = sunspot.search(job)     fulltext params[:job]     paginate(:page => params[:offset], :per_page => 25) end 

it works except need total number of real hits, not total results returned (in case 25 because of :per_page => 25)

in other words, want able display: showing 1 25 out of 883 jobs found

any appreciated!

thanks

the method total works here.

query_results = sunspot.search(recipe)   keywords(params[:qs])   paginate(:page=>params[:page], :per_page=>30) end  @search_results = query_result.results @search_total = @search_results.total 

or, in view, total_entries works on results object.

    %div       search        = params[:qs]       returned       = pluralize(@search_results.total_entries, 'result') 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -