简体   繁体   English

用字段值影响Solr搜索结果

[英]Influencing Solr search results with a field value

I've recently started experimenting with Solr. 我最近开始尝试Solr。 My data is indexed and searchable. 我的数据已建立索引并可以搜索。 My problem is in the sorting. 我的问题是排序。 I have three fields: Author, Title, Sales. 我有三个字段:作者,标题,销售。

I would like to search against the author & title fields, but have the sales value influence the score so that matches with higher sales move toward the top, even if the initial match score is not the highest. 我想在作者和标题字段中进行搜索,但销售价值会影响得分,因此即使初始匹配得分不是最高,销售额较高的匹配也会移至顶部。

Simply sorting by sales does not produce valid results as a result with a near 0 score for the search term, but a lot of sales in general could end up above a perfect match for the term that has never been sold. 简单地按销售额排序不会产生有效的结果,因为搜索词的得分接近于0,但总的来说,很多销售额最终可能会超过从未出售过的术语的完美匹配。

I am seeing results that, while great term matches, are not necessarily the product I want showing at the top of the list. 我看到的结果是,尽管长期匹配,但不一定是我想要显示在列表顶部的产品。

If you're using the dismax handler, you can add a boost function (bf) with the field you want to boost on, eg 如果您使用dismax处理程序,则可以在要增强的字段上添加增强函数 (bf),例如

http://...?q=foo&bf="fieldValue(sales)^1.5"

...to make the value of the sales figure give a bump. ...以提高销售数字的价值。 You can, of course, make the function more complex if you want to munge the sales data in some way. 当然,如果您想以某种方式修改销售数据,则可以使功能更复杂。

More info is easily found. 容易找到更多信息

You may also just want to do this at index time since the sales data isn't going to be changing on the fly. 您可能也只想在索引时间执行此操作,因为销售数据不会随时更改。

You can also use Index-time boosting . 您还可以使用Index-time boosting
And here's detailed info on using function queries to influence scoring . 这里是有关使用函数查询影响评分的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM