可以忽略lucene文档boost吗?
我正在寻找一种方法来告诉 lucene 搜索器忽略某些查询的文档增强?
在我们的搜索结果中,我们通常在索引时使用根据文档年龄计算的主导提升因子(索引每晚重建)。
现在,我正在寻找一种提供忽略年龄的搜索功能的方法,但尚未找到覆盖/忽略文档提升的方法。
最好的问候,
亚历克斯
I am looking for a way to tell the lucene searcher to ignore document boosting on certain queries?
In our search results we usually work with a dominant boost-factor calculated by the age of a document while indexing (the index is rebuild nightly).
Now, I am looking for a way offer search-functionality which ignores the age, but found yet no way to override/ignore the document boost.
Best regards,
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否正在寻找 QueryParser 能够理解的内容?因为那根本不可能。
您在代码中的某个位置添加了 boost,默认情况下 Lucene 不会这样做。您必须删除这段额外的代码,或者将其设为可选,以便忽略提升。
Are you looking for something the QueryParser would understand? Because that is simply not possible.
You're adding the boost somewhere in your code, it is not done by Lucene by default. You'll have to remove this additional piece of code, or make it optional in order to ignore the boost.
http://lucene.apache.org /java/3_0_0/api/core/org/apache/lucene/search/Similarity.html
从第6点开始,我认为在搜索时忽略提升是不可能的:
http://lucene.apache.org/java/3_0_0/api/core/org/apache/lucene/search/Similarity.html
From the point 6, I reckon it is impossible to ignore boosts at search time:
您可以将计算出的分数存储在新字段中,而不是将其存储为 boost,并且通过实施 CustomScoreQuery + CustomScoreProvider 您可以控制哪个返回值(默认分数或您在字段中计算的分数)
Instead of storing your calculated-score as boost, you can store it in a new field, and by implementing CustomScoreQuery + CustomScoreProvider you can control which value(default score or your calculated-one in the field) to return