You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/07/31 23:07:54 UTC

[GitHub] [lucene-solr] jtibshirani opened a new pull request #1709: LUCENE-9446: In boolean rewrite, remove MatchAllDocsQuery filter clauses

jtibshirani opened a new pull request #1709:
URL: https://github.com/apache/lucene-solr/pull/1709


   Previously, we only removed 'match all' FILTER clauses if there was at least one
   MUST clause. Now they're also removed if there is another distinct FILTER clause.
   
   This lets boolean queries like `#field:value #*:*` be written to `#field:value`.


----------------------------------------------------------------
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.

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


[GitHub] [lucene-solr] jpountz merged pull request #1709: LUCENE-9446: In boolean rewrite, remove MatchAllDocsQuery filter clauses

Posted by GitBox <gi...@apache.org>.
jpountz merged pull request #1709:
URL: https://github.com/apache/lucene-solr/pull/1709


   


----------------------------------------------------------------
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.

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


[GitHub] [lucene-solr] jpountz commented on a change in pull request #1709: LUCENE-9446: In boolean rewrite, remove MatchAllDocsQuery filter clauses

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #1709:
URL: https://github.com/apache/lucene-solr/pull/1709#discussion_r464552982



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanRewrites.java
##########
@@ -312,12 +312,20 @@ public void testRemoveMatchAllFilter() throws IOException {
         .add(new TermQuery(new Term("foo", "baz")), Occur.MUST)
         .add(new MatchAllDocsQuery(), Occur.FILTER)
         .build();
-    BooleanQuery expected = new BooleanQuery.Builder()
+    Query expected = new BooleanQuery.Builder()
         .setMinimumNumberShouldMatch(bq.getMinimumNumberShouldMatch())
         .add(new TermQuery(new Term("foo", "bar")), Occur.MUST)
         .add(new TermQuery(new Term("foo", "baz")), Occur.MUST)
         .build();
     assertEquals(expected, searcher.rewrite(bq));
+
+    bq = new BooleanQuery.Builder()
+            .add(new TermQuery(new Term("foo", "bar")), Occur.FILTER)
+            .add(new MatchAllDocsQuery(), Occur.FILTER)
+            .build();
+    expected = new BoostQuery(new ConstantScoreQuery(
+            new TermQuery(new Term("foo", "bar"))), 0.0f);
+    assertEquals(expected, searcher.rewrite(bq));

Review comment:
       maybe also add a test for the case when there are two `MatchAllDocsQuery` queries as filters with no `MUST` clauses?




----------------------------------------------------------------
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.

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


[GitHub] [lucene-solr] jtibshirani commented on a change in pull request #1709: LUCENE-9446: In boolean rewrite, remove MatchAllDocsQuery filter clauses

Posted by GitBox <gi...@apache.org>.
jtibshirani commented on a change in pull request #1709:
URL: https://github.com/apache/lucene-solr/pull/1709#discussion_r464554625



##########
File path: lucene/core/src/test/org/apache/lucene/search/TestBooleanRewrites.java
##########
@@ -312,12 +312,20 @@ public void testRemoveMatchAllFilter() throws IOException {
         .add(new TermQuery(new Term("foo", "baz")), Occur.MUST)
         .add(new MatchAllDocsQuery(), Occur.FILTER)
         .build();
-    BooleanQuery expected = new BooleanQuery.Builder()
+    Query expected = new BooleanQuery.Builder()
         .setMinimumNumberShouldMatch(bq.getMinimumNumberShouldMatch())
         .add(new TermQuery(new Term("foo", "bar")), Occur.MUST)
         .add(new TermQuery(new Term("foo", "baz")), Occur.MUST)
         .build();
     assertEquals(expected, searcher.rewrite(bq));
+
+    bq = new BooleanQuery.Builder()
+            .add(new TermQuery(new Term("foo", "bar")), Occur.FILTER)
+            .add(new MatchAllDocsQuery(), Occur.FILTER)
+            .build();
+    expected = new BoostQuery(new ConstantScoreQuery(
+            new TermQuery(new Term("foo", "bar"))), 0.0f);
+    assertEquals(expected, searcher.rewrite(bq));

Review comment:
       👍 




----------------------------------------------------------------
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.

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


[GitHub] [lucene-solr] jpountz commented on pull request #1709: LUCENE-9446: In boolean rewrite, remove MatchAllDocsQuery filter clauses

Posted by GitBox <gi...@apache.org>.
jpountz commented on pull request #1709:
URL: https://github.com/apache/lucene-solr/pull/1709#issuecomment-668657783


   FYI I backported to 8.7 and moved the CHANGES entry from 9.0 to 8.7.


----------------------------------------------------------------
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.

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


[GitHub] [lucene-solr] jtibshirani commented on pull request #1709: LUCENE-9446: In boolean rewrite, remove MatchAllDocsQuery filter clauses

Posted by GitBox <gi...@apache.org>.
jtibshirani commented on pull request #1709:
URL: https://github.com/apache/lucene-solr/pull/1709#issuecomment-668155437


   Thanks for the review, I added another test and a changelog entry.


----------------------------------------------------------------
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.

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