donnerpeter commented on code in PR #11857: URL: https://github.com/apache/lucene/pull/11857#discussion_r997326314
########## lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Hunspell.java: ########## @@ -614,11 +617,27 @@ private void doSuggest( Runnable checkCanceled) { Hunspell suggestionSpeller = new Hunspell(dictionary, policy, checkCanceled) { + final Map<String, Optional<Root<CharsRef>>> compoundCache = new HashMap<>(); Review Comment: It's a per-`suggest`-call cache, it will be GCed afterwards. It caches the prefixes tried as the first parts of potential compounds. The cached `findStem` calls are relatively expensive, and there can be thousands of them for each `suggest`. If such a call returns `null`, the rest of a word won't be split for compounds, so caching nulls is essential. I hope this makes things clearer. Which parts of this would you like in the comment? :) -- 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