You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/01/19 08:30:06 UTC

[GitHub] [lucene-solr] dweiss commented on a change in pull request #2207: LUCENE-9667: Hunspell: add spellchecker API, support BREAK and FORBIDDENWORD affix rules

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



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/SpellChecker.java
##########
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.analysis.hunspell;
+
+import org.apache.lucene.util.BytesRef;
+
+/**
+ * A spell checker based on Hunspell dictionaries. Thread-safe. Not all Hunspell features are
+ * supported yet.
+ */
+public class SpellChecker {
+  private final Dictionary dictionary;
+  private final ThreadLocal<Stemmer> stemmer;

Review comment:
       A suggestion. If it's not absolutely necessary to make it thread-safe then I'd just use non-thread safe fields. If something is concurrent up the stack then it can be handled there (as a thread local SpellChecker). Or just store the dictionary and create an instance of SpellChecker on demand, it's a cheap operation?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org