0

I want to boost a record's matching score if its value in field A is greater than a certain number.

For example, if the value in A is greater than 4, I would like to give it a boost of 5. I tried the following for bf and bq separately, but it did not work.

if(A>4,5,0)

How should I do it?

user2868104
  • 297
  • 2
  • 14

1 Answers1

0

You need to use a FunctionQuery. With edismax queryparser, you need to specify the boost query parameter in the following way:

bq=if(A>4,5,1)
AR1
  • 4,507
  • 4
  • 26
  • 42
  • thanks, but that is what I used. I am in solr dashboard and specefied `if(A>4,5,1)` in the bq box. I got the following error. `"error":{ "metadata":[ "error-class","org.apache.solr.common.SolrException", "root-error-class","org.apache.solr.common.SolrException"], "msg":"undefined field: \"A\"", "code":400}}` – user2868104 Aug 13 '16 at 13:32
  • @user2868104 is `A` the actual name of your field? – antislice Mar 13 '19 at 17:53