sgup432 commented on code in PR #15818:
URL: https://github.com/apache/lucene/pull/15818#discussion_r2989043538
##########
lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java:
##########
@@ -425,24 +426,39 @@ public Query rewrite(IndexSearcher indexSearcher) throws
IOException {
}
}
- // Deduplicate SHOULD clauses by summing up their boosts
+ // Deduplicate SHOULD clauses. Tracks [boostSum, count] per query.
+ // Uses Similarity.computeQueryTermWeight for unweighted duplicates (e.g.
"a a a"),
+ // falls back to linear boost sum when explicit boosts are present (e.g.
"a^2 a^3").
Review Comment:
Yeah I was also a bit torn on how to handle this scenario in case user
passes explicit boost. Which is why I fallback to the default linear sum just
to be safe.
Scenarios I can think of:
1. User passes `hello^2 hello^2 hello^2`: Considering user mentions that
hello is 2x important, but mention it 3 times, should we do `2 *
computeQueryTermWeight(3)` instead of linear sum?
2. In case they pass `hello^2 hello^3`, they have explicitly mentioned
different boost, so I guess we fallback to linear sum?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]