1

Is there a way to achieve the following -

We have a RANK field in each document, and essentially, I would like my score to be influenced by this RANK as follows -

score = (score * 0.1) + RANK

How can I achieve this with function queries or through some other mechanism

Solr Version # 7.4.0

Thanks!

jagamot
  • 5,348
  • 18
  • 59
  • 96

1 Answers1

1

The bf (boost function) and bq functions are both additive, meaning that their result is added to the existing score.

So instead of multiplying the score by 0.1, multiply the popularity by 10 (in effect giving you the same rank):

bf=product(RANK,10)

(mul is an alias for product)

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • How can it me the same rank? The reason I want to multiply the score by 0.1 is to consider only 10% of the score and add my RANK giving 90% weightage to it. So, If score = 5 and RANK=10, I am trying to achieve the following - `score = score * 0.1 + RANK = 5 * 0.1 + 10 = 10.5` Where as by doing above it will do the following - `score = score + RANK * 10 = 5 + 100 = 105` Am I missing anything ? – jagamot Aug 24 '18 at 22:11
  • 1
    Yes, but the point isn't that the _values_ will be the same, but that the RANK contributes the same weight to the end score. In your example the "score" factor is 4.7% of the score, and in the second example, the original score is 4.7% of the score. The absolute values does not matter. Another problem is that scores can be normalized for the query as well, so the "RANK" and "score" values won't be the same scale for all queries when compared to RANK. – MatsLindh Aug 25 '18 at 18:29
  • I see. Thanks for the explanation. Can you also please look into the following ? https://stackoverflow.com/questions/51978351/solr-custom-similarity-using-a-field-from-the-indexed-document – jagamot Aug 26 '18 at 03:06