if you run -Dtests.verbose, QueryUtils now advertises when it's opening an IndexWriter to make an empty index

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1588921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-04-21 16:40:52 +00:00
parent a14dbd1159
commit a7478c8d17

View File

@ -205,12 +205,18 @@ public class QueryUtils {
private static IndexReader makeEmptyIndex(Random random, final int numDocs) throws IOException {
assert numDocs > 0;
Directory d = new MockDirectoryWrapper(random, new RAMDirectory());
if (LuceneTestCase.VERBOSE) {
System.out.println("NOTE: QueryUtils: now create empty index");
}
IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
for (int i = 0; i < numDocs; i++) {
w.addDocument(new Document());
}
w.forceMerge(1);
w.shutdown();
if (LuceneTestCase.VERBOSE) {
System.out.println("NOTE: QueryUtils: done create empty index");
}
DirectoryReader reader = DirectoryReader.open(d);
return new AllDeletedFilterReader(LuceneTestCase.getOnlySegmentReader(reader));
}