LUCENE-883: consecutive calls to Spellchecker.indexDictionary() won't insert terms twice anymore. Fixes the test case failure.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@539732 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2007-05-19 11:27:54 +00:00
parent b5c6b784c7
commit 3c4dc0484b
2 changed files with 13 additions and 0 deletions

View File

@ -125,6 +125,9 @@ Bug fixes
has written the postings. Then the resources associated with the has written the postings. Then the resources associated with the
TokenStreams can safely be released. (Michael Busch) TokenStreams can safely be released. (Michael Busch)
16. LUCENE-883: consecutive calls to Spellchecker.indexDictionary()
won't insert terms twice anymore. (Daniel Naber)
New features New features
1. LUCENE-759: Added two n-gram-producing TokenFilters. 1. LUCENE-759: Added two n-gram-producing TokenFilters.

View File

@ -313,6 +313,16 @@ public class SpellChecker {
// close writer // close writer
writer.optimize(); writer.optimize();
writer.close(); 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) { private int getMin(int l) {