0
votes

Let's say I have 4 fields: field1,field2,field3 and boost1 and a boost function f. I want to obtain a score field1_score+field2_score*f(boost1)+field3_score*f(boost1) which should look like q=field1:value1 OR (field2:value2 OR field3:value3)^f(boost1), but Solr complains that its invalid and returns an Lexical error.

The current solr query look like: defType=edismax&q=field1:value1 OR field2:value2 OR field3:value3&boost=f(boost1). But in this way, the value from boost section will also have effect on the score of field1:value1 makes it equals to field1_score*f(boost1)+field2_score*f(boost1)+field3_score*f(boost1).

I've looked around for solution for this for a while but failed to find one. Any help is appreciated!

1

1 Answers

0
votes

You can use the query function and other Solr functions to create any custom scoring you want.

For example you can do:

q=*:*
bf=sum(query($q1),mul(query($q2),${boost1}),mul(query($q3),${boost1}))
q1=field1:value1
q2=field2:value2
q3=field3:value3
boost1=5
  • Of course you should set boost1 to whatever you want