dweiss commented on a change in pull request #2207:
URL: https://github.com/apache/lucene-solr/pull/2207#discussion_r560161656



##########
File path: 
lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/SpellChecker.java
##########
@@ -24,22 +24,24 @@
  */
 public class SpellChecker {
   private final Dictionary dictionary;
-  private final ThreadLocal<Stemmer> stemmer;
-  private final ThreadLocal<BytesRef> scratch = 
ThreadLocal.withInitial(BytesRef::new);
+  private final BytesRef scratch = new BytesRef();
 
-  public SpellChecker(Dictionary dictionary) {
+  private SpellChecker(Dictionary dictionary) {

Review comment:
       Hey Peter. Sorry, perhaps I wasn't clear - I'd leave the public 
SpellChecker class with a non-static spell(String word) method in. I just 
wouldn't try to make it thread-safe. Imagine you have a gazillion words to 
spell-check - then you'd create SpellChecker and just apply it in a loop to all 
the words. This seems intuitive to me. I just don't think it needs to be 
decorated with thread locals internally... this was the bit I was concerned 
with.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to