msokolov commented on code in PR #16229:
URL: https://github.com/apache/lucene/pull/16229#discussion_r3390459036
##########
lucene/core/src/java/org/apache/lucene/search/BooleanWeight.java:
##########
@@ -97,14 +98,19 @@ public Explanation explain(LeafReaderContext context, int
doc) throws IOExceptio
subs.add(
Explanation.noMatch("no match on required clause (" +
c.query().toString() + ")", e));
fail = true;
+ } else if (c.occur() == Occur.SHOULD) {
+ failingOptionals.add(
+ Explanation.noMatch("no match on optional clause (" +
c.query().toString() + ")", e));
}
}
if (fail) {
return Explanation.noMatch(
"Failure to meet condition(s) of required/prohibited clause(s)",
subs);
} else if (matchCount == 0) {
+ subs.addAll(failingOptionals);
return Explanation.noMatch("No matching clauses", subs);
} else if (shouldMatchCount < minShouldMatch) {
+ subs.addAll(failingOptionals);
Review Comment:
I wonder if in this case we should include all of the optional clauses, and
not merely the failing ones? Otherwise it's hard to tell how many of the
failing clauses would have had to match in order for the entire query to match.
Maybe we could just add a count to the description, like "Failure to match min
... <mincount>, only <count> matched".
--
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]