In Apache Solr, how to give a mutiplicative boost to documents where a certain field has a certain value?

29 Views Asked by At

Let's say I want to add a term which multiplies the score of all documents where the field "category" has the value "clothing" by 10.

If I wanted to give an additive boost, this would have been very simple.

&bq=category:clothing^10

However, for multiplicative boost, how do we achieve the same?

One solution I could think of was using termfreq in the following way:

&boost=map(termfreq(category,clothing),0,0.1,1,10);

Here we find the documents where the frequency of "clothing" in the field "category" is greater than 0 and assign it a multiplicative boost of 10.

However there has got to be a better way than this. Also this wouldn't work if along with clothing, I also had to put a condition on the value of some other field, example let's say I want to add a multiplicative boost of 10 to documents where "category" is "clothing" and "material" is either "cotton" or "linen". I'd appreciate any help on this.

0

There are 0 best solutions below