[
https://issues.apache.org/jira/browse/LUCENE-10651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17568114#comment-17568114
]
Adrien Grand commented on LUCENE-10651:
---------------------------------------
bq. But I like your fix – it prevents a StackOverflowException when the
returned Query would have failed with TooManyClauses anyways.
I like this approach too.
> SimpleQueryParser stack overflow for large nested queries.
> ----------------------------------------------------------
>
> Key: LUCENE-10651
> URL: https://issues.apache.org/jira/browse/LUCENE-10651
> Project: Lucene - Core
> Issue Type: Bug
> Affects Versions: 9.1, 8.10, 9.2, 9.3
> Reporter: Marc Handalian
> Priority: Major
>
> The OpenSearch project received an issue [1] where stack overflow can occur
> for large nested boolean queries during rewrite. In trying to reproduce this
> error I've also encountered SO during parsing where queries expand beyond the
> default 1024 clause limit. This unit test will fail with SO:
> {code:java}
> public void testSimpleQueryParserWithTooManyClauses() {
> StringBuilder queryString = new StringBuilder("foo");
> for (int i = 0; i < 1024; i++) {
> queryString.append(" | bar").append(i).append(" + baz");
> }
> expectThrows(IndexSearcher.TooManyClauses.class, () ->
> parse(queryString.toString()));
> }
> {code}
> I would expect this case to also fail with TooManyClauses, is my
> understanding correct? If so, I've attempted a fix [2] that during parsing
> increments a counter whenever a clause is added.
> [1] [https://github.com/opensearch-project/OpenSearch/issues/3760]
> [2]
> [https://github.com/mch2/lucene/commit/6a558f17f448b92ae4cf8c43e0b759ff7425acdf]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]