Solr:如何动态提升有限数量的文档? QueryElevationComponent 是否需要修改?
我的要求是针对用户请求提升有限数量(例如五个)文档。
我得到的是一个文档字段,它存储一个类似于表示电梯排名值的提升值的数值。
因此,用户查询将返回 5 个具有最高电梯排名值的文档,其余文档按常规顺序填充页面。
怎么做呢?
QueryElevationComponent
仅允许静态查询定义。提升不允许提升特殊电梯排名字段的有限数量文档。
我必须编写修改后的 QueryElevationComponent 吗?如果是,是否有很好的示例如何做到这一点?
或者是否存在另一种方法,我没有赶上?
感谢您的任何提示或想法!
my requirement is to elevate a limited number of (e.g. five) documents for a user request.
What I've got is a single document field which stores a numerical value similar to a boosting value which represents an elevator ranking value.
So a user query would return 5 documents with the highest elevator ranking value and the remaining documents to fill a page in regular order.
How to do that?
The QueryElevationComponent
does only allow static query definitions. Boosting does not allow to boost a limited number of documents for the special elevator ranking field.
Do I have to write a modified QueryElevationComponent? If yes, are there good examples how to do that?
Or does another approach exists, I didnt catched up?
Thank you for any hints or ideas!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会采用以下两种方法之一:
这两种方法都会产生不可预测的结果(因为 Solr 中的相关性模型非常复杂)。然而,通过函数查询,您可以进行更多微调。
I would have one of these two approaches:
Both these methods can produce unpredictable results (since the relevance model in Solr is very complex). However with the function query you are able to fine tune a bit more.
找到了使用两个单独请求的解决方案。
首先按该分数字段增强文档。使用分页来限制结果。从结果页面获取唯一的文档 ID,并在新请求中显式提升这些 ID。
Found a solution using two separate requests.
First boost documents by that score field. Use pagination to limit the result. Take the unique document ids from the result page and boost these ones explicitly within a new request.