benwtrent commented on code in PR #12072:
URL: https://github.com/apache/lucene/pull/12072#discussion_r1067160561
##########
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:
The key issue for the bug was when there was no scoring, and thus fell into
the `rewriteNoScoring` case from the CSQ.
All my testing indicates that runtime doesn't exponentially grow when we
need scoring as we don't use the CSQ redirect.
--
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]