开发者

Boost results in Solr by certain field?

开发者 https://www.devze.com 2022-12-10 19:02 出处:网络
I\'m pretty new to Solr but I\'m trying to integrate it in to my website. I\'ve been looking in ways to \"boost\" results in Solr queries, but I\'m having a hard time unde开发者_运维技巧rstanding how

I'm pretty new to Solr but I'm trying to integrate it in to my website. I've been looking in ways to "boost" results in Solr queries, but I'm having a hard time unde开发者_运维技巧rstanding how to achieve what I'm trying to do.

I'm trying to "boost" certain results in Solr searches that have the field "userId" set to 1. For example, if there were two documents in the index that had the exact same text relevance but the first document had the "userId" field set to "1" and the other had it set to "4", then the first document would be positioned higher in the results.

Is there anyway I can do this? Thank you very much!


There are several ways you can do this:

  • Boost the documents that have userId=1 at index-time
  • Boost the field userId of the documents that have userId=1 at index-time
  • Use a FunctionQuery at query-time

Also take a look at the Solr relevancy FAQ where this kind of questions are answered.


use "&sort=score desc,userId asc" as parameter might help

0

精彩评论

暂无评论...
验证码 换一张
取 消