huug
huug

Reputation: 1057

Thinking Sphinx without condition on 'id'

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

Answers (2)

huug
huug

Reputation: 1057

The solution is to define an index as follows:

define_index do
  has user(:id)
end

Upvotes: 2

ipsum
ipsum

Reputation: 1052

Why you don't use ActiveRecord for this simple query?

User.find(:all, :conditions => ["id NOT IN (?)", [1, 3]])

Upvotes: 0

Related Questions