问题描述
我的要求是为用户请求提升有限数量的(例如五个)文档。
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.
因此,用户查询将返回具有最高电梯排名值的5个文档和剩余文档以按正常顺序填充页面。
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.
如何做到这一点?
QueryElevationComponent
仅允许静态查询定义。 Boosting不允许为特殊电梯排名字段提升数量有限的文档。
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.
我是否必须编写修改后的QueryElevationComponent?如果是,是否有良好的示例如何做到这一点?
Do I have to write a modified QueryElevationComponent? If yes, are there good examples how to do that?
或另一种方法存在,我没有抓到up?
Or does another approach exists, I didnt catched up?
感谢您提供任何提示或想法!
Thank you for any hints or ideas!
推荐答案
使用两个单独的请求找到解决方案。
Found a solution using two separate requests.
首先按该得分字段提升文档。使用分页来限制结果。从结果页面获取唯一的文档ID,并在新请求中明确地提升这些文档ID。
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.
这篇关于Solr:如何动态提升有限数量的文件?是否要修改QueryElevationComponent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!