IndexWriter writer = newWriter(dir, false);
writer.setMaxBufferedDocs(10);
writer.setMergeFactor(4);
writer.addIndexesNoOptimize(new Directory[] { aux, aux });
assertEquals(1060, writer.docCount());
assertEquals(1000, writer.getDocCount(0));
writer.close();
// make sure the index is correct
verifyNumDocs(dir, 1060);