是否可以在 lucene 中使用负查询提升?
我想惩罚查询中的某些术语,而不是完全忽略它们,因此“不得”运算符不起作用? 是否可以在 lucene 的布尔查询中使用 SHOULD 的负查询提升,它是如何工作的?
I want to penalize some terms in query, not to ignore them at all so "MUST NOT" operator will not work?
Is it possible to use negative query boost with SHOULD in boolean query in lucene, how does it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,查询词提升只是一个乘法因子,因此将其设置为负值将获得您想要的效果。
这是 lucene 邮件列表中讨论负提升。
总之,类似于 NOT,但不太严格,因为匹配文档仍将出现在搜索结果中,即
任何正分数 (>0) 都会产生增加默认分数的影响。
任何负分数(<0)都会降低默认分数。
Yes, a query term boost is simply a multiplication factor, so setting it to a negative value will have the affect you want.
Here's a thread from the lucene mailing list discussing negative boost.
In summary in is like a NOT but less strict, in that matching documents will still appear in search results i.e.
Any positive score (>0) will have the affect of increasing the default score.
Any negative score (<0) will have the affect of decreasing the default score.
似乎从 Lucene 8 开始就不再允许它们了:
来源:https://github.com/elastic/elasticsearch/issues/33309
Seems that they are since Lucene 8 no longer allowed:
Source: https://github.com/elastic/elasticsearch/issues/33309