lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1715930 - /lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
Date Mon, 23 Nov 2015 19:34:00 GMT
Author: jpountz
Date: Mon Nov 23 19:34:00 2015
New Revision: 1715930

URL: http://svn.apache.org/viewvc?rev=1715930&view=rev
Log:
LUCENE-6906: Make the new BaseDocValuesFormatTestCase tests pass with old codecs that don't
support all features.

Modified:
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java?rev=1715930&r1=1715929&r2=1715930&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
Mon Nov 23 19:34:00 2015
@@ -3174,7 +3174,12 @@ public abstract class BaseDocValuesForma
 
     SortedDocValues dv = getOnlySegmentReader(ireader).getSortedDocValues("field");
     for (int i = 0; i < numEmptyDocs; ++i) {
-      assertEquals(-1, dv.getOrd(i));
+      if (codecSupportsDocsWithField()) {
+        assertEquals(-1, dv.getOrd(i));
+      } else {
+        assertEquals(0, dv.getOrd(i));
+        assertEquals(new BytesRef(), dv.lookupOrd(0));
+      }
     }
 
     ireader.close();
@@ -3183,6 +3188,7 @@ public abstract class BaseDocValuesForma
 
   // same as testSortedSetMergeAwayAllValues but on more than 1024 docs to have sparse encoding
on
   public void testSortedSetMergeAwayAllValuesLargeSegment() throws IOException {
+    assumeTrue("Codec does not support SORTED_SET", codecSupportsSortedSet());
     Directory directory = newDirectory();
     Analyzer analyzer = new MockAnalyzer(random());
     IndexWriterConfig iwconfig = newIndexWriterConfig(analyzer);
@@ -3241,7 +3247,11 @@ public abstract class BaseDocValuesForma
     Bits docsWithField = getOnlySegmentReader(ireader).getDocsWithField("field");
     for (int i = 0; i < numEmptyDocs; ++i) {
       assertEquals(0, dv.get(i));
-      assertFalse(docsWithField.get(i));
+      if (codecSupportsDocsWithField()) {
+        assertFalse(docsWithField.get(i));
+      } else {
+        assertTrue(docsWithField.get(i));
+      }
     }
 
     ireader.close();
@@ -3250,6 +3260,7 @@ public abstract class BaseDocValuesForma
 
   // same as testSortedNumericMergeAwayAllValues but on more than 1024 docs to have sparse
encoding on
   public void testSortedNumericMergeAwayAllValuesLargeSegment() throws IOException {
+    assumeTrue("Codec does not support SORTED_NUMERIC", codecSupportsSortedNumeric());
     Directory directory = newDirectory();
     Analyzer analyzer = new MockAnalyzer(random());
     IndexWriterConfig iwconfig = newIndexWriterConfig(analyzer);
@@ -3308,7 +3319,11 @@ public abstract class BaseDocValuesForma
     Bits docsWithField = getOnlySegmentReader(ireader).getDocsWithField("field");
     for (int i = 0; i < numEmptyDocs; ++i) {
       assertEquals(new BytesRef(), dv.get(i));
-      assertFalse(docsWithField.get(i));
+      if (codecSupportsDocsWithField()) {
+        assertFalse(docsWithField.get(i));
+      } else {
+        assertTrue(docsWithField.get(i));
+      }
     }
 
     ireader.close();



Mime
View raw message