benwtrent commented on code in PR #12072:
URL: https://github.com/apache/lucene/pull/12072#discussion_r1067175218


##########
lucene/core/src/test/org/apache/lucene/search/TestBooleanRewrites.java:
##########
@@ -322,6 +323,45 @@ public void testMatchAllMustNot() throws IOException {
     assertEquals(new MatchNoDocsQuery(), searcher.rewrite(bq2));
   }
 
+  public void testDeeplyNestedBooleanRewrite() throws IOException {
+    IndexSearcher searcher = newSearcher(new MultiReader());
+
+    Directory dir = newDirectory();
+    (new RandomIndexWriter(random(), dir)).close();
+    IndexReader r = DirectoryReader.open(dir);
+    Function<Integer, TermQuery> termQueryFunction =
+        (i) -> new TermQuery(new Term("layer[" + i + "]", "foo"));
+    int depth = TestUtil.nextInt(random(), 10, 30);
+    TermQuery tq = termQueryFunction.apply(depth);
+    Query expectedQuery = new BooleanQuery.Builder().add(tq, 
Occur.FILTER).build();

Review Comment:
   Also, the wrapping (I think you mean in the CSQ) we do in the main rewrite 
is ONLY in the non-scoring case, when `BooleanClause.Occur#FILTER` or 
`BooleanClause.Occur#MUST_NOT`. So, only `BooleanQuery` objects that are under 
those non-scoring clauses would be wrapped. I am not sure what we would test in 
this case...



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

Reply via email to