Apache Lucene open-source search software
LUCENE-883: consecutive calls to Spellchecker.indexDictionary() won't insert terms twice anymore. Fixes the test case failure.
Daniel Naber3c4dc0484b82
diff --git a/CHANGES.txt b/CHANGES.txtindex c284078ef05..039016081fe 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -125,6 +125,9 @@ Bug fixeshas written the postings. Then the resources associated with theTokenStreams can safely be released. (Michael Busch)+16. LUCENE-883: consecutive calls to Spellchecker.indexDictionary()+ won't insert terms twice anymore. (Daniel Naber)+New features1. LUCENE-759: Added two n-gram-producing TokenFilters.diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.javaindex d5633b9c144..eaae663d0e3 100755--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java@@ -313,6 +313,16 @@ public class SpellChecker {// close writerwriter.optimize();writer.close();+ // close reader so it will be re-opened (and see the new content) when exist()+ // is called the next time:+ if (reader != null) {+ reader.close();+ reader = null;+ }+ // also re-open the spell index to see our own changes when the next suggestion+ // is fetched:+ searcher.close();+ searcher = new IndexSearcher(this.spellIndex);}private int getMin(int l) {