Reputation: 2305
I'm working on a Solr query that has 4 OR conditions with one AND condition:
(
(
{!dismax qf=respondent_address_txt mm=3<70% v=$q2}^3.0
OR
{!dismax qf=respondent_addresses_txt mm=3<70% v=$q2}^1.0
OR
{!dismax qf=respondent_address_txt mm=3<70% v=$q3}^3.0
OR
{!dismax qf=respondent_addresses_txt mm=3<70% v=$q3}^1.0
)
AND
{!dismax qf=respondent_name_txt mm=2<70% v=$q1}^3.0
)
Is it possible that of for OR conditions score don't add up instead they should take max of them,
say 4 separate query parts results in scores 1,2,3,4, than instead of total score as 10 it should be 4.
Upvotes: 1
Views: 345
Reputation: 16095
Yes, (e)dismax query parsers allows precisely to do that using the tie
parameter.
The default makes a "disjunction max query" already, so having the sum instead means this parameter may be overridden somewhere in your config or in the request (set to 1.0
instead of 0.0
).
The tie parameter lets you control how much the final score of the query will be influenced by the scores of the lower scoring fields compared to the highest scoring field.
A value of "0.0" - the default - makes the query a pure "disjunction max query": that is, only the maximum scoring subquery contributes to the final score.
value of "1.0" makes the query a pure "disjunction sum query" where it doesn’t matter what the maximum scoring sub query is, because the final score will be the sum of the subquery scores. Typically a low value, such as 0.1, is useful.
Upvotes: 2