Ruby on rails Rails Sunspot Solr any_of with scalar field和全文搜索

Ruby on rails Rails Sunspot Solr any_of with scalar field和全文搜索,ruby-on-rails,solr,sunspot,sunspot-rails,sunspot-solr,Ruby On Rails,Solr,Sunspot,Sunspot Rails,Sunspot Solr,我正在使用rails 4.0和sunspot solr。我想就这一点做一点调查: (read_标志为TRUE)或((read_标志为NIL)和(全文) params[:search]为true)) 这是我在(post.rb)中的代码: 但是,上面的代码将生成此错误 # 因此,我尝试将all\u of更改为all。但它并没有归还我想要的东西 模型文件(post.rb)的索引如下所示 searchable do integer :user_id text :title, :boo

我正在使用rails 4.0和sunspot solr。我想就这一点做一点调查:

(read_标志为TRUE)或((read_标志为NIL)和(全文) params[:search]为true))

这是我在
(post.rb)
中的代码:

但是,上面的代码将生成此错误 #

因此,我尝试将
all\u of
更改为
all
。但它并没有归还我想要的东西

模型文件
(post.rb)
的索引如下所示

  searchable do
    integer :user_id
    text :title, :boost => 2
    integer :model_id
  end  

有谁能建议我应该如何构造我的查询?找不到有关stackoverflow的任何相关问题。

我相信您可能很久以前就已经超越了这一点,因此为了任何可能找到此问题的人的利益,我正在使用任何和全文进行类似的搜索。我发现在全文之前结束连接/分离似乎是可行的:

@search =  Post.search do
  any_of
     with :model_id,params[:model_id]
     all_of
        with :model_id, nil
     end
  end
  fulltext params[:search] do
     fields(:title,:tags)
  end

end

有什么解决办法吗?
@search =  Post.search do
  any_of
     with :model_id,params[:model_id]
     all_of
        with :model_id, nil
     end
  end
  fulltext params[:search] do
     fields(:title,:tags)
  end

end