我有一个在多个字段中搜索的solr查询。为了增加召回率,我还进行通配符和模糊查询。我使用edismax查询解析器,因为我还必须使用boost函数。
以下是查询的相关部分:
defType=edismax&q= (wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02&qf=primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5
现在,以上查询在所有字段(wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02
上搜索primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5
,但是我想要的是(wine AND company)
仅应在merchant_name_s^0.5
,{{1 }}在(wine* AND company*)^0.5 OR (wine* OR company*)^0.01
上,primary_tags^1
在(wine~1 AND company~1)^0.02
上。
实现该目标的正确方法是什么?
答案 0 :(得分:0)
edismax supports the full Lucene syntax。
q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004
应该与您描述的查询相同。我将secondary_tags_s
部分合并为一个权重,并分隔了primary_tags
子句,因为无论如何,默认行为是两个术语之间的OR
(取决于q.op
)。 / p>