Description
When a wildcard contains repeated asterisks the memory consumption is quadratic because automaton.Operations.concatenate has to keep chaining if there patterns match empty strings.
This can all be avoided by just ignoring repeated asterisks.
WildcardQuery.toAutomaton(new Term("field", "*".repeat(10000))
Version and environment details
Lucene 10.2.2 with Opensearch 2.19.5 but can replicate the same behaviour with the main branch.
Description
When a wildcard contains repeated asterisks the memory consumption is quadratic because automaton.Operations.concatenate has to keep chaining if there patterns match empty strings.
This can all be avoided by just ignoring repeated asterisks.
WildcardQuery.toAutomaton(new Term("field", "*".repeat(10000))
Version and environment details
Lucene 10.2.2 with Opensearch 2.19.5 but can replicate the same behaviour with the main branch.