freelancing-god/thinking-sphinx — Issue #321: Support "all" method to populate search results
Author: adrianmacneil
Created: 2011-12-20 10:27:21+00:00
State: open

It would be nice if the all method was available to trigger your private 'populate' method in ThinkingSphinx::Search.

E.g. in active record you can chain scopes, and then call .all to populate:

Post.where(:title => "Example").all

With Thinking Sphinx I am chaining methods with kaminari style pagination:

@rooms = Room.search("example").page(params[:page]).per(24)

This doesn't work (because it seems to override the pagination):

@rooms = Room.search("example").page(params[:page]).per(24).search :populate => true

This works, but is ugly since I use kaminari everywhere else:

@rooms = Room.search "example", :page => params[:page], :per_page => 24, :populate => true

This would be nice:

@rooms = Room.search("example").page(params[:page]).per(24).all

I'm relatively new to rails, so .all was the first thing I tried, but got a no method error. Let me know if I'm missing an existing method - I can only see the private 'populate' method which does what I want, or :populate => true.

Thanks for the awesome plugin :)