0

I have added fs_votingapi_result in solr document this represents number of likes.

I found below function to improve the score based on fs_votingapi_result.

But I am unable to get the logic behind this - what are the extra parameters $vote_steepness, $total, $total, $vote_boost?

bf=recip(rord(fs_votingapi_result),$vote_steepness,$total,$total)^$vote_boost

I am new to solr and I am not able to find any document/article to get more idea about this.

GrafikRobot
  • 3,020
  • 1
  • 20
  • 21
Rakesh K
  • 692
  • 4
  • 13
  • 26

1 Answers1

1

This is in the Function Query documentation.

recip

A reciprocal function with recip(x,m,a,b) implementing a/(m*x+b). m,a,b are constants, x is any numeric field or arbitrarily complex function.


rord

The reversed ordinal of the indexed value. (In your case, the function: rord(fs_votingapi_result) would yield 1 for the record w the most votes, 2 for the second most votes, etc...)


So

recip(rord(fs_votingapi_result),$vote_steepness,$total,$total)

= $total / ($vote_steepness * rev-ordinal-of-vote-result + $total)

Then the result is boosted by $vote_boost to create the boost function (from bf param).

= ($total / ($vote_steepness * rev-ordinal-of-vote-result + $total)) * $vote_boost

Which is added to the document score from the rest of the query. (Then before scores are returned, they are normalized across all matching docs)

The $<var> values are either defined in solrconfig.xml or more commonly passed as separate http query parameters.

Hope that gives you a starting point.

Peter Dixon-Moses
  • 3,169
  • 14
  • 18
  • I got the formula behind it. But how boots works?? how the bost value ^$vote_boost affects the score?? Is there ant formula of it? How solr internally manages it? – Rakesh K Dec 27 '15 at 08:08
  • The `^$vote_boost` is multiplying the result by the boost value (edited answer). However, hit scores are all normalized, so the scores returned by Solr won't align directly with the formula... However the ordering will be the same as it would be if you calculate it by hand. – Peter Dixon-Moses Dec 28 '15 at 02:56
  • 1
    To better understand the formula, it might help to initially ignore *steepness* and *boost* values. Simplified: `total / (rev-ordinal + total)`. So in a 10-item election, the winner would cause the simplified function here to output `10/(1+10) ~= 0.91` while the last place would cause the simplified function to output `10/(10+10) = 0.5`. – Peter Dixon-Moses Dec 28 '15 at 03:10