((MockDirectoryWrapper) directory).setAssertNoUnrefencedFilesOnClose(false);
}
IndexWriter writer = new IndexWriter(
directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).
setOpenMode(OpenMode.CREATE).
setMaxBufferedDocs(-1).
setMergePolicy(newLogMergePolicy(10))
);
SegmentCommitInfo si1 = indexDoc(writer, "test.txt");
printSegment(out, si1);
SegmentCommitInfo si2 = indexDoc(writer, "test2.txt");
printSegment(out, si2);
writer.close();
SegmentCommitInfo siMerge = merge(directory, si1, si2, "_merge", false);
printSegment(out, siMerge);
SegmentCommitInfo siMerge2 = merge(directory, si1, si2, "_merge2", false);
printSegment(out, siMerge2);
SegmentCommitInfo siMerge3 = merge(directory, siMerge, siMerge2, "_merge3", false);
printSegment(out, siMerge3);
directory.close();
out.close();
sw.close();
String multiFileOutput = sw.getBuffer().toString();
//System.out.println(multiFileOutput);
sw = new StringWriter();
out = new PrintWriter(sw, true);
directory = newFSDirectory(indexDir, null);
if (directory instanceof MockDirectoryWrapper) {
// We create unreferenced files (we don't even write
// a segments file):
((MockDirectoryWrapper) directory).setAssertNoUnrefencedFilesOnClose(false);
}
writer = new IndexWriter(
directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).
setOpenMode(OpenMode.CREATE).
setMaxBufferedDocs(-1).
setMergePolicy(newLogMergePolicy(10))
);