|
@@ -1,5 +1,6 @@
|
|
|
package cn.reghao.tnb.search.app.lucene;
|
|
package cn.reghao.tnb.search.app.lucene;
|
|
|
|
|
|
|
|
|
|
+import cn.reghao.tnb.search.api.dto.IndexCount;
|
|
|
import cn.reghao.tnb.search.app.config.ElasticProperties;
|
|
import cn.reghao.tnb.search.app.config.ElasticProperties;
|
|
|
import org.apache.lucene.analysis.Analyzer;
|
|
import org.apache.lucene.analysis.Analyzer;
|
|
|
import org.apache.lucene.document.Document;
|
|
import org.apache.lucene.document.Document;
|
|
@@ -143,7 +144,7 @@ public class LuceneIndex {
|
|
|
indexWriter.close();
|
|
indexWriter.close();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void check(String indexName) throws IOException {
|
|
|
|
|
|
|
+ public IndexCount countIndex(String indexName) throws IOException {
|
|
|
IndexWriter indexWriter = getIndexWriter(indexName);
|
|
IndexWriter indexWriter = getIndexWriter(indexName);
|
|
|
IndexReader indexReader = getIndexReader(indexWriter);
|
|
IndexReader indexReader = getIndexReader(indexWriter);
|
|
|
|
|
|
|
@@ -154,6 +155,7 @@ public class LuceneIndex {
|
|
|
// 被标记删除的索引文档
|
|
// 被标记删除的索引文档
|
|
|
int numDeletedDocs = indexReader.numDeletedDocs();
|
|
int numDeletedDocs = indexReader.numDeletedDocs();
|
|
|
indexWriter.close();
|
|
indexWriter.close();
|
|
|
|
|
+ return new IndexCount(maxDocs, numDocs, numDeletedDocs);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void restore() {
|
|
public void restore() {
|