apache 通过特定领域提升 Solr 的结果?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1657122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Boost results in Solr by certain field?
提问by Andy Cox
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 understanding how to achieve what I'm trying to do.
我对 Solr 很陌生,但我正在尝试将其集成到我的网站中。我一直在寻找在 Solr 查询中“提升”结果的方法,但我很难理解如何实现我想要做的事情。
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.
我试图在 Solr 搜索中“提升”某些结果,这些结果将字段“userId”设置为 1。例如,如果索引中有两个文档具有完全相同的文本相关性,但第一个文档具有“userId” " 字段设置为 "1" 而另一个将其设置为 "4",那么第一个文档将在结果中定位更高。
Is there anyway I can do this? Thank you very much!
无论如何我可以做到这一点吗?非常感谢!
回答by Mauricio Scheffer
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 FAQwhere this kind of questions are answered.
另请查看Solr 相关性常见问题解答,其中回答了此类问题。
回答by 2ni
use "&sort=score desc,userId asc" as parameter might help
使用“&sort=score desc,userId asc”作为参数可能会有所帮助

