I am creating an index using Lucene .Net 2.9.2. After a lot of indexing, the index has many segments and deleted documents, so I am calling Optimize(numSegmets) on the IndexWriter.
The index's segments count is indeed reduced to the value of numSegmets, but it still has deletions... doesnt a call to Optimize should also remove all deleted documents?
My question is very important so I could know if this is how Lucene works or maybe I have some bug...
Edit: here is my code snippet:
IndexWriter writer = new IndexWriter(/*open writer from index directroy*/);
writer.Optimize(5);
writer.Commit();
bool hasDeletions = writer.HasDeletions();
hasDeletions is true, while I was expecting it would be false...