You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "vismaytiwari (via GitHub)" <gi...@apache.org> on 2026/07/09 17:23:40 UTC

Re: [I] Wildcard.toAutomaton consumes an excessive amount with repeated asterisks. [lucene]

vismaytiwari commented on issue #16134:
URL: https://github.com/apache/lucene/issues/16134#issuecomment-4927795817

   Hi! I was able to reproduce this on current `main` and opened a draft PR with a small fix: https://github.com/apache/lucene/pull/16382
   
   The issue happens because consecutive unescaped `*` wildcards are converted into separate `Automata.makeAnyString()` automata before concatenation. The PR collapses consecutive unescaped `*` tokens while preserving escaped `\*` as a literal.
   
   Locally, `WildcardQuery.toAutomaton(new Term("field", "*".repeat(10000)))` went from building `50,005,000` transitions to building `1` transition. I also added a regression test and verified it with `TestWildcardQuery` and `:lucene:core:check`.
   


-- 
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: issues-unsubscribe@lucene.apache.org

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