dsmiley commented on a change in pull request #1037: LUCENE-9062: QueryVisitor.consumeTermsMatching URL: https://github.com/apache/lucene-solr/pull/1037#discussion_r350488231
########## File path: lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java ########## @@ -156,9 +160,13 @@ public Automaton toAutomaton() { @Override public void visit(QueryVisitor visitor) { - // TODO find some way of consuming Automata - if (visitor.acceptField(term.field())) { - visitor.visitLeaf(this); + if (visitor.acceptField(field)) { + if (maxEdits == 0 || prefixLength >= term.text().length()) { + visitor.consumeTerms(this, term); + } else { + visitor.consumeTermsMatching(this, field, + new ByteRunAutomaton(toAutomaton(), false, Operations.DEFAULT_MAX_DETERMINIZED_STATES)); Review comment: At least we should acknowledge in a comment that this is expensive :-/ At least I could imagine a user solving this by subclassing FuzzyQuery to override toAutomaton and using a cache. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org