mirror of https://github.com/apache/lucene.git
LUCENE-2858: fix spellchecker
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene2858@1237313 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d7fe56ddae
commit
1906da16d0
|
@ -28,6 +28,8 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.index.AtomicIndexReader;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
|
@ -166,7 +168,7 @@ public class SpellChecker implements java.io.Closeable {
|
|||
// modifications to the directory should be synchronized
|
||||
synchronized (modifyCurrentIndexLock) {
|
||||
ensureOpen();
|
||||
if (!IndexReader.indexExists(spellIndexDir)) {
|
||||
if (!DirectoryReader.indexExists(spellIndexDir)) {
|
||||
IndexWriter writer = new IndexWriter(spellIndexDir,
|
||||
new IndexWriterConfig(Version.LUCENE_CURRENT,
|
||||
null));
|
||||
|
@ -497,7 +499,7 @@ public class SpellChecker implements java.io.Closeable {
|
|||
if (reader.maxDoc() > 0) {
|
||||
new ReaderUtil.Gather(reader) {
|
||||
@Override
|
||||
protected void add(int base, IndexReader r) throws IOException {
|
||||
protected void add(int base, AtomicIndexReader r) throws IOException {
|
||||
Terms terms = r.terms(F_WORD);
|
||||
if (terms != null)
|
||||
termsEnums.add(terms.iterator(null));
|
||||
|
|
Loading…
Reference in New Issue