2

In Solr8 I am trying to execute a negative boost query using bf tag.

Solr8 bf query for a negative boost. Migrating from Solr6 to Solr8, so updating negative boost as follows:

Solr6: bq=catConfidence:("0")^-100.0

Solr8: bq=(**:** -catConfidence:"0")^100.0

This works fine for bq tag. I want it as part of bf tag,

bf=(*:* -catConfidence:"0")^100.0 , this is not working.

As a negative boost is not working in Solr8, I tried

bf= (*:* -catConfidence)^10.0

Any advice on how to write bf for negative boosting.

EricLavault
  • 12,130
  • 3
  • 23
  • 45
  • The `bq` and `bf` arguments are not used in the same way. `bf` is for _boost functions_, while `bq` is for _boost queries_. You're using a query, so `bq` would be the correct argument to use. What is your goal by using `bf` instead? – MatsLindh Aug 11 '19 at 17:42
  • I am trying to execute this function : scale(catConfidence,0,1)^-10.0. For this, I am getting the error as " boost must be a positive float, got -10.0". – anup junagade Aug 12 '19 at 13:11

1 Answers1

1

Negative boost functions are not supported by Solr.

A workaround is to reverse the local score given by the function itself so that you can apply a regular (positive) boost on it.

For example, this query :

bf=scale(catConfidence,0,1)^-10.0

would become :

bf=div(1,scale(catConfidence,0.000001,1)))^10.0

(I changed the scale min to prevent division by 0).

EricLavault
  • 12,130
  • 3
  • 23
  • 45