Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据Thinking Sphinx上的文档,应该可以在 id 上添加过滤条件,但以下代码没有给出任何结果:
User.search(:without => {:id => [1,3]})
我究竟做错了什么?还有另一种方法吗?
解决方案是定义一个索引如下:
define_index do has user(:id) end
为什么不使用 ActiveRecord 进行这个简单的查询?
User.find(:all, :conditions => ["id NOT IN (?)", [1, 3]])