}
reader.close();
// test doc count before segments are merged/index is optimized
writer = new IndexWriter(dir, new WhitespaceAnalyzer());
assertEquals(100, writer.docCount());
writer.close();
reader = IndexReader.open(dir);
assertEquals(100, reader.maxDoc());
assertEquals(60, reader.numDocs());