Use function query to increase score in Solr

I am working on Solr 4 to optimize the ranking of my solr results based on the popularity rating stored in Index.

Now that someone is looking, in addition to relevance ranking, I want to influence the relevance rating using the popularity rating. The simplest formula can be:

new radiance rank = rating * popularrank

I looked at the Solr function request at http://wiki.apache.org/solr/FunctionQuery#product to achieve the same, but I'm not sure how to get it working. I did not understand how to multiply the score using the product function. Trying to do this, I always get an error because the field is undefined.

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

For example, I tried to execute the following simple query, which 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 the estimate as $ v2, however I cannot find how to do it.

Any help is very complicated.

+3
full-text-search lucene solr solrnet solr4
source share
2 answers

You can try using the _val_ hook provided by Solr.

For example, to sort by score * popularityrank try using this

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

Use the query () function to get the score value.

So, if you are trying to do this: new_score = rating * popularity , use the following format.

q = searchterm & sort = product (query ($ q), popularity) desc

query ($ q) - returns the TF-IDF score for the query. Thus, this is equivalent to using the grade field.

0
source share

All Articles