I'm trying to boost the score of a document according to the value of a floating number field from the document.
For example, the user may search for "Oliphaunts named ron, with height between 6 and 10 meters" and I'd like to query the height
field in a manner akin to a DecayFunction.
In the following simplified query I expect to retrieve oliphaunts scored by name and height, where height closer to 8 meters is better -
q=name:"ron" _val_:"div(1,abs(sub(height,8)))"
I've drafted my exponential-decay scoring function using a combination of math operands and regular functions -
exp(sub(0,div(pow(max(0,sub(abs(sub(value,origin)),offset)),2),mul(2,sub(0,div(pow(scale,2),mul(2,ln(decay))))))))
Now I'd like to incorporate this function into the query score using the _val_
magic field.
How can I accomplish this in Solrj?
What other ways are there (instead of _val_
) to do this?
{p.s. - I'm using the standard query parser, in Solr 5.3.1}