madrob 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_r362860716
########## File path: lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java ########## @@ -101,7 +106,19 @@ public FuzzyQuery(Term term, int maxEdits, int prefixLength, int maxExpansions, this.prefixLength = prefixLength; this.transpositions = transpositions; this.maxExpansions = maxExpansions; + int[] codePoints = FuzzyTermsEnum.stringToUTF32(term.text()); + this.termLength = codePoints.length; + this.automata = FuzzyTermsEnum.buildAutomata(term.text(), codePoints, prefixLength, transpositions, maxEdits); setRewriteMethod(new MultiTermQuery.TopTermsBlendedFreqScoringRewrite(maxExpansions)); + this.ramBytesUsed = calculateRamBytesUsed(term, this.automata); + } + + private static long calculateRamBytesUsed(Term term, CompiledAutomaton[] automata) { Review comment: Is this going to be a few primitives short? I'm not very well versed in how accurate the RAM usage is expected to be, so I'm not sure if that matters or not. ---------------------------------------------------------------- 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