add test verbosity

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@994935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-09-08 09:33:00 +00:00
parent 5bb82c1670
commit 5d74641c6c
1 changed files with 17 additions and 0 deletions

View File

@ -5140,6 +5140,9 @@ public class TestIndexWriter extends LuceneTestCase {
RandomIndexWriter w = new RandomIndexWriter(rand, dir, newIndexWriterConfig(rand, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(_TestUtil.nextInt(rand, 5, 20)));
//w.w.setInfoStream(System.out);
//w.w.setUseCompoundFile(false);
if (VERBOSE) {
w.w.setInfoStream(System.out);
}
final int docCount = 200*RANDOM_MULTIPLIER;
final int fieldCount = _TestUtil.nextInt(rand, 1, 5);
@ -5153,6 +5156,10 @@ public class TestIndexWriter extends LuceneTestCase {
final Map<String,Document> docs = new HashMap<String,Document>();
if (VERBOSE) {
System.out.println("TEST: build index docCount=" + docCount);
}
for(int i=0;i<docCount;i++) {
Document doc = new Document();
doc.add(idField);
@ -5176,11 +5183,17 @@ public class TestIndexWriter extends LuceneTestCase {
}
if (rand.nextInt(5) == 3 && i > 0) {
final String delID = ""+rand.nextInt(i);
if (VERBOSE) {
System.out.println("TEST: delete doc " + delID);
}
w.deleteDocuments(new Term("id", delID));
docs.remove(delID);
}
}
if (VERBOSE) {
System.out.println("TEST: " + docs.size() + " docs in index; now load fields");
}
if (docs.size() > 0) {
String[] idsList = docs.keySet().toArray(new String[docs.size()]);
@ -5188,6 +5201,10 @@ public class TestIndexWriter extends LuceneTestCase {
IndexReader r = w.getReader();
IndexSearcher s = new IndexSearcher(r);
if (VERBOSE) {
System.out.println("TEST: cycle x=" + x + " r=" + r);
}
for(int iter=0;iter<1000*RANDOM_MULTIPLIER;iter++) {
String testID = idsList[rand.nextInt(idsList.length)];
TopDocs hits = s.search(new TermQuery(new Term("id", testID)), 1);