Lucene展示了奇怪的未提交文件

时间:2010-09-25 21:14:18

标签: java lucene

我将一堆文档提交给新创建的索引并提交/优化&关闭作家。 当我在同一个VM中打开并读取索引时,一切都按预期工作。 一旦我关闭VM,重新启动并读取新应用程序实例中的索引,我就会收到大量文档。

当我通过luke检查索引时,我看到索引中的第一个文档是已提交的,但后面跟着很多只包含一个名为“word”的字段的文档。

搜索索引按预期工作,但我对numDocs返回的庞大数字感到好奇。顺便说一句:我使用的是最新的Java Lucene 3.0.2。

关于这个人的任何想法?

致以最诚挚的问候,

亚历

这里有一些代码示例:

File indexDirectory = new File(...);
Directory directory = FSDirectory.open(indexDirectory);
IndexSearcher searcher = new IndexSearcher(directory, true);

// I also use a spellchecker, but this should not affect anything (I hope)
IndexReader reader = IndexReader.open(directory, true);
SpellChecker spellChecker = new SpellChecker(directory);
spellChecker.indexDictionary(new LuceneDictionary(reader, "headline"));
spellChecker.indexDictionary(new LuceneDictionary(reader, "intro"));


int numDocs = searcher.getIndexReader().numDocs();
int maxDoc = searcher.getIndexReader().maxDoc();

1 个答案:

答案 0 :(得分:0)

我会尝试强制代码索引一个文档,提交&关闭作者,然后用Luke检查索引。这可能会提示您“文字”文件的来源。