Hi,
I submit a bunch of documents to a newly created index and commit/optimize & close the writer. When I open and read from the index while in the same VM everything works as expected. As soon as I close the VM, restart and read the index in a new application instance, I get a multitude of documents.
When I inspect the index via luke I see that the first documents in the index are as committed, but followed by very many documents containing only one field called "word".
Searching the index works as expected, but I got curious about the huge number returned by numDocs. By the way: I am using the lastest Java Lucene 3.0.2.
Any ideas on this anyone?
Best regards,
Alex
Here some code example:
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();