rails solr search limit total search results / get fixed number of results
- by kLeos
I'm trying to perform a search, order the results randomly, and only return a number of results, not all matches. Something like limit(2)
I've tried using the Solr param 'rows' but that doesn't seem to do anything:
@featured_articles = Article.search do
with(:is_featured, true)
order_by :random
adjust_solr_params do |params|
params[:rows] = 2
end
end
@featured_articles.total should be 2, but it returns more than 2
How can I get a randomized fixed number of results?