提交 d1659f78 authored 作者: Andrei Tokar's avatar Andrei Tokar

automatic re-indexing of the incompatible index, fix MANIFEST

上级 78807abb
......@@ -45,7 +45,7 @@ Import-Package: javax.crypto,
org.apache.lucene.analysis.standard;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.document;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.index;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.queryParser;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.queryparser;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.search;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.store;version="[5.5.5,6.0.0)";resolution:=optional,
org.apache.lucene.util;version="[5.5.5,6.0.0)";resolution:=optional,
......
......@@ -25,6 +25,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexFormatTooOldException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
......@@ -294,7 +295,7 @@ public class FullTextLucene extends FullText {
String path = getIndexPath(conn);
synchronized (INDEX_ACCESS) {
IndexAccess access = INDEX_ACCESS.get(path);
if (access == null) {
while (access == null) {
try {
Directory indexDir = path.startsWith(IN_MEMORY_PREFIX) ?
new RAMDirectory() : FSDirectory.open(Paths.get(path));
......@@ -304,10 +305,14 @@ public class FullTextLucene extends FullText {
IndexWriter writer = new IndexWriter(indexDir, conf);
//see http://wiki.apache.org/lucene-java/NearRealtimeSearch
access = new IndexAccess(writer);
} catch (IndexFormatTooOldException e) {
reindex(conn);
continue;
} catch (IOException e) {
throw convertException(e);
}
INDEX_ACCESS.put(path, access);
break;
}
return access;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论