我正在使用Sunspot for Rails,我想从Sunspot生成的Solr参数中删除过滤器查询(看作fq: ["type:Job"]
):
当前:
SOLR Request [ path=select parameters={fq: ["type:Job"], q: "programmer", fl: "* score", qf: "Title", defType: "edismax", start: 0, rows: 30} ]
渴望:
SOLR Request [ path=select parameters={q: "programmer", fl: "* score", qf: "Title", defType: "edismax", start: 0, rows: 30} ]
我的模特:
class Job < ActiveRecord::Base
searchable do
text :Title, :as => :Title
end
我已阅读文档中的"manually adjusting Solr parameters",但未找到任何实际删除 fq
参数的引用。谢谢!
答案 0 :(得分:5)
你不能使用
Job.search do
adjust_solr_params do |params|
params.except! :fq
end
end
或者类似的东西,以便从params散列中删除:fq键