問題描述
我的要求是針對用戶請求提升有限數量(例如五個)文檔.
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
只允許static 查詢定義.提升不允許提升特殊電梯排名字段的有限數量文檔.
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?
或者是否存在另一種方法,我沒有趕上?
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 是否需要修改?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!