Ruby on rails Rails和Sphinx:如何使用多个选项搜索:无

Ruby on rails Rails和Sphinx:如何使用多个选项搜索:无,ruby-on-rails,ruby-on-rails-3,sphinx,thinking-sphinx,Ruby On Rails,Ruby On Rails 3,Sphinx,Thinking Sphinx,如何在Sphinx with Rails中传递多个选项:without选项? 我已经看过了,但什么也没想到 User.search params[:search], :without => {:id => current_user.id && current_user.other_users.collect { |other_user| other_user.id} # user cannot be self & user cannot

如何在Sphinx with Rails中传递多个选项:without选项? 我已经看过了,但什么也没想到

User.search params[:search],
    :without => {:id => current_user.id && current_user.other_users.collect { 
      |other_user| other_user.id} # user cannot be self & user cannot already be a contact
    } # This is where I'm having the problem!

谢谢你的帮助!我觉得答案很简单,我只是错过了。。。也许我累了,或者什么的=/

有一个未记录的选项叫做
:没有任何
。它接受一个散列,该散列的键是要筛选的属性,该值是该属性不应匹配的值的数组。在这种情况下,我认为你可以这样做:

contact_ids = current_user.other_users.collect(&:id)
User.search params[:search], :without_any => {:id => [current_user.id, contact_ids].flatten }

非常感谢!奇怪的是,会有一些像这样的未记录的东西。