romseygeek commented on a change in pull request #1042: LUCENE-9068: Build FuzzyQuery automata up-front URL: https://github.com/apache/lucene-solr/pull/1042#discussion_r362775126
########## File path: lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java ########## @@ -58,30 +60,42 @@ // which we use to know when we can reduce the automaton from ed=2 to ed=1, or ed=0 if only single top term is collected: private final MaxNonCompetitiveBoostAttribute maxBoostAtt; - // We use this to share the pre-built (once for the query) Levenshtein automata across segments: - private final LevenshteinAutomataAttribute dfaAtt; + private final CompiledAutomaton[] automata; private float bottom; private BytesRef bottomTerm; - private final CompiledAutomaton automata[]; private BytesRef queuedBottom; - final int termLength; + private final int termLength; // Maximum number of edits we will accept. This is either 2 or 1 (or, degenerately, 0) passed by the user originally, // but as we collect terms, we can lower this (e.g. from 2 to 1) if we detect that the term queue is full, and all // collected terms are ed=1: private int maxEdits; - final Terms terms; - final Term term; - final int termText[]; - final int realPrefixLength; + private final Terms terms; + private final Term term; + + /** + * Constructor for enumeration of all terms from specified <code>reader</code> which share a prefix of + * length <code>prefixLength</code> with <code>term</code> and which have at most {@code maxEdits} edits. + * <p> + * After calling the constructor the enumeration is already pointing to the first + * valid term if such a term exists. + * + * @param terms Delivers terms. + * @param term Pattern term. + * @param maxEdits Maximum edit distance. + * @param prefixLength the length of the required common prefix + * @param transitions whether transitions should count as a single edit Review comment: Because I can't read or type, apparently... have fixed ---------------------------------------------------------------- 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