LUCENE-3606: fix test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1210734 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-12-06 01:11:08 +00:00
parent 1ae93d3697
commit 8b80aac679
1 changed files with 7 additions and 12 deletions

View File

@ -17,9 +17,9 @@ package org.apache.lucene.index;
* limitations under the License.
*/
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
@ -38,11 +38,14 @@ public class TestSumDocFreq extends LuceneTestCase {
RandomIndexWriter writer = new RandomIndexWriter(random, dir);
Document doc = new Document();
Field id = newField("id", "", StringField.TYPE_UNSTORED);
Field field1 = newField("foo", "", TextField.TYPE_UNSTORED);
Field field2 = newField("bar", "", TextField.TYPE_UNSTORED);
doc.add(id);
doc.add(field1);
doc.add(field2);
for (int i = 0; i < numDocs; i++) {
id.setValue("" + i);
char ch1 = (char) _TestUtil.nextInt(random, 'a', 'z');
char ch2 = (char) _TestUtil.nextInt(random, 'a', 'z');
field1.setValue("" + ch1 + " " + ch2);
@ -53,28 +56,20 @@ public class TestSumDocFreq extends LuceneTestCase {
}
IndexReader ir = writer.getReader();
writer.close();
assertSumDocFreq(ir);
ir.close();
/* nocommit: fix this to use IW to delete documents
ir = IndexReader.open(dir);
int numDeletions = atLeast(20);
for (int i = 0; i < numDeletions; i++) {
ir.deleteDocument(random.nextInt(ir.maxDoc()));
writer.deleteDocuments(new Term("id", "" + random.nextInt(numDocs)));
}
ir.close();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
w.forceMerge(1);
w.close();
writer.forceMerge(1);
writer.close();
ir = IndexReader.open(dir);
assertSumDocFreq(ir);
ir.close();
*/
dir.close();
}