LUCENE-3606: fix test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1211997 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-12-08 17:24:54 +00:00
parent 41bc48f419
commit 356d24d333
1 changed files with 15 additions and 5 deletions

View File

@ -242,7 +242,6 @@ public class TestIndexWriterMerging extends LuceneTestCase
dir.close();
}
/* nocommit: Fix tests to use an id and delete by term
// LUCENE-325: test forceMergeDeletes without waiting, when
// many adjacent merges are required
public void testForceMergeDeletes3() throws IOException {
@ -269,15 +268,27 @@ public class TestIndexWriterMerging extends LuceneTestCase
document.add(storedField);
Field termVectorField = newField("termVector", "termVector", customType1);
document.add(termVectorField);
for(int i=0;i<98;i++)
Field idField = newField("id", "", StringField.TYPE_UNSTORED);
document.add(idField);
for(int i=0;i<98;i++) {
idField.setValue("" + i);
writer.addDocument(document);
}
writer.close();
IndexReader ir = IndexReader.open(dir);
assertEquals(98, ir.maxDoc());
assertEquals(98, ir.numDocs());
for(int i=0;i<98;i+=2)
ir.deleteDocument(i);
ir.close();
IndexWriterConfig dontMergeConfig = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
writer = new IndexWriter(dir, dontMergeConfig);
for(int i=0;i<98;i+=2) {
writer.deleteDocuments(new Term("id", "" + i));
}
writer.close();
ir = IndexReader.open(dir);
assertEquals(49, ir.numDocs());
ir.close();
@ -294,7 +305,6 @@ public class TestIndexWriterMerging extends LuceneTestCase
ir.close();
dir.close();
}
*/
// Just intercepts all merges & verifies that we are never
// merging a segment with >= 20 (maxMergeDocs) docs