You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "epotyom (via GitHub)" <gi...@apache.org> on 2026/09/14 10:43:48 UTC
[PR] Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause [lucene]
epotyom opened a new pull request, #16667:
URL: https://github.com/apache/lucene/pull/16667
Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause matching one of its MUST boost or constant score query clauses.
It's a follow-up to https://github.com/apache/lucene/pull/16446
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause [lucene]
Posted by "msokolov (via GitHub)" <gi...@apache.org>.
msokolov commented on code in PR #16667:
URL: https://github.com/apache/lucene/pull/16667#discussion_r4048927116
##########
lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java:
##########
@@ -369,6 +369,18 @@ public Query rewrite(IndexSearcher indexSearcher) throws IOException {
if (mustNotClauses.stream().anyMatch(p.or(clauseSets.get(Occur.FILTER)::contains))) {
return new MatchNoDocsQuery("FILTER or MUST clause also in MUST_NOT");
}
+ for (Query q : clauseSets.get(Occur.MUST)) {
Review Comment:
can we merge this with the above check and also include FILTER?
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause [lucene]
Posted by "epotyom (via GitHub)" <gi...@apache.org>.
epotyom commented on PR #16667:
URL: https://github.com/apache/lucene/pull/16667#issuecomment-5887814376
Thanks @msokolov , done
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause [lucene]
Posted by "msokolov (via GitHub)" <gi...@apache.org>.
msokolov merged PR #16667:
URL: https://github.com/apache/lucene/pull/16667
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause [lucene]
Posted by "epotyom (via GitHub)" <gi...@apache.org>.
epotyom commented on code in PR #16667:
URL: https://github.com/apache/lucene/pull/16667#discussion_r4054932820
##########
lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java:
##########
@@ -369,6 +369,18 @@ public Query rewrite(IndexSearcher indexSearcher) throws IOException {
if (mustNotClauses.stream().anyMatch(p.or(clauseSets.get(Occur.FILTER)::contains))) {
return new MatchNoDocsQuery("FILTER or MUST clause also in MUST_NOT");
}
+ for (Query q : clauseSets.get(Occur.MUST)) {
Review Comment:
Good idea, I've merged with the MUST check above. As for FILTER, if I understand correctly there is no need to unwrap boost or constant score query for this case as they are unwrapped already (lines 310-313), but I've added a test to make sure it stays this way (see the first added assert [here](https://github.com/apache/lucene/pull/16667/changes#diff-ded67a199416417d9b2c0c354e1db608ed0d79bf1d745390e5723f0b801861d3R297)), wdyt?
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT clause [lucene]
Posted by "msokolov (via GitHub)" <gi...@apache.org>.
msokolov commented on PR #16667:
URL: https://github.com/apache/lucene/pull/16667#issuecomment-5878416659
It looks like there is a merge conflict in CHANGES -- I tried to resolve, but then it makes it look like I am the author -- do you want to take another pass?
--
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org