Reputation: 1057
According to the documentation on Thinking Sphinx it should be possible to add a filter condition on id, but the following code does not give any results:
User.search(:without => {:id => [1,3]})
What am I doing wrong? Is there another way of doing this?
Upvotes: 2
Views: 780
Reputation: 1057
The solution is to define an index as follows:
define_index do
has user(:id)
end
Upvotes: 2
Reputation: 1052
Why you don't use ActiveRecord for this simple query?
User.find(:all, :conditions => ["id NOT IN (?)", [1, 3]])
Upvotes: 0