lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1442130 - /lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java
Date Mon, 04 Feb 2013 14:30:17 GMT
Author: mikemccand
Date: Mon Feb  4 14:30:16 2013
New Revision: 1442130

URL: http://svn.apache.org/viewvc?rev=1442130&view=rev
Log:
add test

Modified:
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java?rev=1442130&r1=1442129&r2=1442130&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java
Mon Feb  4 14:30:16 2013
@@ -31,6 +31,7 @@ import org.apache.lucene.document.Sorted
 import org.apache.lucene.document.TextField;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCase;
 
@@ -722,4 +723,31 @@ public class TestDocValuesIndexing exten
     dir2.close();
     dir.close();
   }
+
+  public void testDocsWithField() throws Exception {
+    Directory dir = newDirectory();
+    IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
+    IndexWriter writer = new IndexWriter(dir, conf);
+    Document doc = new Document();
+    doc.add(new NumericDocValuesField("dv", 0L));
+    writer.addDocument(doc);
+
+    doc = new Document();
+    doc.add(new TextField("dv", "some text", Field.Store.NO));
+    doc.add(new NumericDocValuesField("dv", 0L));
+    writer.addDocument(doc);
+    
+    DirectoryReader r = writer.getReader();
+    writer.close();
+
+    AtomicReader subR = r.leaves().get(0).reader();
+    assertEquals(2, subR.numDocs());
+
+    Bits bits = FieldCache.DEFAULT.getDocsWithField(subR, "dv");
+    assertTrue(bits.get(0));
+    assertTrue(bits.get(1));
+    r.close();
+    dir.close();
+  }
+
 }



Mime
View raw message