sunspot/sunspot — pull request #114 by langalex (2011-10-26 13:56:10+00:00)
Title: Allow to specify an ActiveRecord scope to filter search results

This patch adds a parameter `store_options` to `search`, which takes a hash. Here's an example:

Post.search do
store_options :activerecord_scope => Post.published
end

Where `published` is a (named) scope on `Post`.This will result in only published posts being returned from the search.

I'm not sure if the API is ideal and if I put everything in its right place. Let me know if I should move things around.

After implementing the whole thing I realized it would be nice to be able to just say `Post.published.search` but haven't investigated it that's feasible.