简体   繁体   中英

Customized Boosting in Solr

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 ie

{
"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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM