boostsolrluceneedismax

SOLR FL and Boost Params Calculation


I have a very complex and long function in my boost param. This function will always return a value from 1 to 50. I would like the results of this function to be included in fl param.

First question is, can I reference the results of the boost in the fl param without having to pass the function AGAIN in the fl param?

Second question is: if I assign a variable to the boost function and then reference this variable in the fl param, will SOLR do the calculation twice? (i mean once for the boost field and another in the fl field)

my boost param function looks like this:

boost=sum(div(5,map(abs(sub(x,y)),0,0,VALUE), termfreq(...), dist(2,0,0,x,y),.....)

the above function is just a brief example to what the boost might look like. In addition, this boost function is dynamically generated. Am using edismax and SOLR v7.6


Solution

  • Parameter substitution happens before anything internal takes place in Solr, so in this case it'd be calculated twice.

    You can append debug=results to your query string to get detailed information about how much each part of your query contributed to the score, and you should be able to extract the amount of boost applied from that debug information (and avoid calculating it twice). You can append debug.explain.structured=true to get the explain information returned as a proper structure instead of as formatted text (with newlines, etc.)