donnerpeter commented on code in PR #11893: URL: https://github.com/apache/lucene/pull/11893#discussion_r1009429597
########## lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/GeneratingSuggester.java: ########## @@ -87,45 +95,31 @@ char transformChar(char c) { sc += commonPrefix(word, rootChars) - longerWorsePenalty(word.length(), rootChars.length); - if (roots.size() == MAX_ROOTS && sc <= roots.peek().score) { + boolean overflow = roots.size() == MAX_ROOTS; + if (overflow && sc <= roots.peek().score) { return; } speller.checkCanceled.run(); String root = rootChars.toString(); - int suitable = filter.findSuitableFormIndex(forms, 0); - do { - roots.add(new Weighted<>(new Root<>(root, forms.ints[forms.offset + suitable]), sc)); - suitable = filter.findSuitableFormIndex(forms, suitable + filter.formStep); - } while (suitable > 0); - while (roots.size() > MAX_ROOTS) { - roots.poll(); + IntsRef forms = formSupplier.get(); + for (int i = 0; i < forms.length; i++) { Review Comment: Here's the loop from the inlined `EntryFilter`, it's now a bit simpler. -- 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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org