0

I'm using Solr in a search app, where data has been divided in different types but in same collection. Each document in collection has d_type field which defines the type of data.

Example

Consider I have 5 type of data

d_type=ds1
d_type=ds2
d_type=ds3
d_type=ds4
d_type=ds5

I want to apply boosting but based on user preferences. I have stored user preferences in other collection against each user. Now on run time I call user preferences collection and fetch preferences of logged-in user in an object i.e

{
"1" : "ds4",
"2" : "ds5",
"3" : "ds1",
"4" : "ds3",
"5" : "ds2",
}

ds4 has highest priority and ds2 has the least priority in above example I've tried adding bq with Solr query but did not get expected result

/select?bq=d_type:ds4^5+d_type:ds5^4+d_type:ds1^3+d_type:ds3^2+d_type:ds2^1

Above query does not work as expected. Please tell me what is wrong here.

solr version : 7.7.2

Thanks

Tayyab Hussain
  • 1,658
  • 1
  • 18
  • 21
  • 2
    Start by looking at the debug output of your query - append `debug=all` to the query string, and it'll tell you exactly how the score of each document is calculated. Your boost factors might just be too small to do anything useful, and the initial score for those that you expect to be boosted more is just too low to make the boost change anything. You'll want to adjust the boost factors in that case; you can also look into using `boost` instead - as that's a multiplicative boost (multiplies the score), instead of `bq` which is additive (added to the score). You can also use multiple `bq`'s – MatsLindh Oct 25 '20 at 20:16

1 Answers1

1

I fixed this problem by

  • adding &defType=edismax

  • adding my multiple bq params

  • increasing the gaps between scores

/select?bq=d_type:ds4^500&bq=d_type:ds5^400&bq=d_type:ds1^300&bq=d_type:ds3^200&bq=d_type:ds2^100&defType=edismax
Tayyab Hussain
  • 1,658
  • 1
  • 18
  • 21