使用函数查询来提高Solr中的分数 [英] Use function query for boosting score in Solr

查看:284
本文介绍了使用函数查询来提高Solr中的分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



现在,当有人搜索时,除了相关性排名外,我还想要一个搜索结果排名使用人气排名影响相关性排名。最简单的公式可以是:

lockquote
新的相关性等级= score * popularrank

我一直在寻找Solr函数查询在 http:// wiki .apache.org / solr / FunctionQuery#产品来实现同样的功能,但我不确定如何使其发挥作用。我没有得到如何使用产品功能获得分数。试图完成它,我总是得到错误,因为字段未定义。



现在我可以使用此处定义的boost 如何增强solr中的字段,但是我希望使用Solr提供的功能查询来增加逻辑/要求。



例如,我尝试了以下简单的查询,看起来可行

  HTTP:// solr的:8983 / solr的/选择q =马力%20laptop&安培; DEFTYPE = edismax&安培; FL = ID,名字,得分&安培; BF =产物%28 $ V1,$ V2%29&安培; V1 =编号&安培; V2 = 2 

现在,对于我的实际需求,我想将得分作为$ v2,但是我无法找到如何做到这一点。



任何帮助都非常适合。

解决方案

您可以尝试使用Solr提供的 _val _ / p>

例如,为了按 score * popularrank 进行排序,请尝试使用这个

  http:// solr:8983 / solr / select?q = hp%20laptop& _val_ =product(score,popularityrank)


I working on a Solr 4 for optimizing my solr results rank based on popularity rank stored in Index.

Now when someone searches, apart from relevancy rank, I want to influence relevancy rank using popularity rank. The simplest formula could be:

new relavancy rank = score * popularityrank

I have been looking at Solr function query at http://wiki.apache.org/solr/FunctionQuery#product to achieve the same however, I'm not sure how to get it to work. I didn't get how to get score multiplied using product function. Trying to get it done, I always get error as field not defined.

Now I can use boost as defined here How to boost fields in solr, but I have additional logic/requirement where I want to use functional query provided by Solr.

For example, I have tried with following simple query that seems to work

http://solr:8983/solr/select?q=hp%20laptop&defType=edismax&fl=Id,Name,score&bf=product%28$v1,$v2%29&v1=Id&v2=2

Now, for my actual requirement, I want to take score as $v2, however I am not able to find how to do this.

Any help is highly appreicated.

解决方案

You can try using the _val_ hook provided by Solr.

For instance, in order to sort by score * popularityrank, try using this

http://solr:8983/solr/select?q=hp%20laptop&_val_="product(score,popularityrank)"

这篇关于使用函数查询来提高Solr中的分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆