lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1210734 - /lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSumDocFreq.java
Date Tue, 06 Dec 2011 01:11:08 GMT
Author: rmuir
Date: Tue Dec  6 01:11:08 2011
New Revision: 1210734

URL: http://svn.apache.org/viewvc?rev=1210734&view=rev
Log:
LUCENE-3606: fix test

Modified:
    lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSumDocFreq.java

Modified: lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSumDocFreq.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSumDocFreq.java?rev=1210734&r1=1210733&r2=1210734&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSumDocFreq.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSumDocFreq.java
Tue Dec  6 01:11:08 2011
@@ -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 Luce
     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 Luce
     }
     
     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();
   }
   



Mime
View raw message