romseygeek commented on code in PR #16103:
URL: https://github.com/apache/lucene/pull/16103#discussion_r3334151839
##########
lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java:
##########
@@ -282,15 +282,27 @@ public Query rewrite(IndexSearcher indexSearcher) throws
IOException {
List<Query> rewrittenDisjuncts = new ArrayList<>();
for (Query sub : disjuncts) {
Query rewrittenSub = sub.rewrite(indexSearcher);
- actuallyRewritten |= rewrittenSub != sub;
- rewrittenDisjuncts.add(rewrittenSub);
+ if (rewrittenSub != sub || sub.getClass() == MatchNoDocsQuery.class) {
Review Comment:
```suggestion
if (rewrittenSub != sub || rewrittenSub instanceof MatchNoDocsQuery) {
```
##########
lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java:
##########
@@ -282,15 +282,27 @@ public Query rewrite(IndexSearcher indexSearcher) throws
IOException {
List<Query> rewrittenDisjuncts = new ArrayList<>();
for (Query sub : disjuncts) {
Query rewrittenSub = sub.rewrite(indexSearcher);
- actuallyRewritten |= rewrittenSub != sub;
- rewrittenDisjuncts.add(rewrittenSub);
+ if (rewrittenSub != sub || sub.getClass() == MatchNoDocsQuery.class) {
+ actuallyRewritten = true;
+ }
+ if (rewrittenSub.getClass() != MatchNoDocsQuery.class) {
Review Comment:
```suggestion
if (rewrittenSub.getClass() instanceof MatchNoDocsQuery == false) {
```
##########
lucene/CHANGES.txt:
##########
@@ -139,6 +139,9 @@ Improvements
Optimizations
---------------------
+* GITHUB#16103: DisjunctionMaxQuery now filters out MatchNoDocsQuery disjuncts
during rewrite,
Review Comment:
Move to 10.5
--
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]