如何在solr中根据字段的* Price *(例如"受欢迎程度")更改文档的分数

时间:2016-07-14 06:51:27

标签: solr solr6

如何提升记录取决于Solr中的任何字段。

参考链接:https://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_increase_the_score_for_specific_documents

但我的情况并非如此。

我在搜索后有一些记录

enter image description here

如何获得Id:5,8,17和1上升一些不是列表的顶部,只是提高一步。因为它的价格更高。

这是我的行查询;

select?mm=100%25&version=2.2&q=(book)&defType=edismax&spellcheck.q=(book)&qf=Price^10+Name^1+nGramContent&spellcheck=true&stats=true&facet.mincount=1&facet=true&spellcheck.collate=true&stats.field=Price&rows=50&indent=on&wt=json&fl=Id,score,Price

请帮帮我。

谢谢!

1 个答案:

答案 0 :(得分:0)

qf参数用于字段中的 hits ,除非查询在字段中产生匹配,否则不会影响排名。您的示例将要求您搜索book参数可以提升的任何内容的价格(而不是qf=Price^10)。

您链接的常见问题解答回答了您的问题,而不是您引用的问题:How can I change the score of a document based on the value of a field。从示例中(用您的案例替换普及价格):

# simple boosts by popularity
defType=dismax&qf=text&q=supervillians&bf=popularity
q={!boost b=popularity}text:supervillians

# boosts based on complex functions of the popularity field
defType=dismax&qf=text&q=supervillians&bf=sqrt(popularity)
q={!boost b=sqrt(popularity)}text:supervillians

edismax也使{!boost}(乘法提升)可用作boost=参数,因此您可以直接引用它,而不是在查询中使用它。

相关问题