lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim...@apache.org
Subject svn commit: r1131367 - in /lucene/dev/branches/docvalues/lucene/src: java/org/apache/lucene/index/values/VarStraightBytesImpl.java test/org/apache/lucene/index/values/TestDocValuesIndexing.java
Date Sat, 04 Jun 2011 10:30:19 GMT
Author: simonw
Date: Sat Jun  4 10:30:19 2011
New Revision: 1131367

URL: http://svn.apache.org/viewvc?rev=1131367&view=rev
Log:
LUCENE-3170: Fixed wrong in-memory ValuesEnum on BYTES_VAR_STRAIGHT type

Modified:
    lucene/dev/branches/docvalues/lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java
    lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java

Modified: lucene/dev/branches/docvalues/lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java?rev=1131367&r1=1131366&r2=1131367&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java
(original)
+++ lucene/dev/branches/docvalues/lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java
Sat Jun  4 10:30:19 2011
@@ -146,6 +146,20 @@ class VarStraightBytesImpl {
             : (int) (addresses.get(1 + docID) - address);
         return data.fillSlice(bytesRef, address, length);
       }
+      
+      @Override
+      public ValuesEnum getEnum(AttributeSource attrSource) throws IOException {
+        return new SourceEnum(attrSource, type(), this, maxDoc()) {
+          @Override
+          public int advance(int target) throws IOException {
+            if (target >= numDocs) {
+              return pos = NO_MORE_DOCS;
+            }
+            source.getBytes(target, bytesRef);
+            return pos = target;
+          }
+        };
+      }
 
       @Override
       public int getValueCount() {

Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java?rev=1131367&r1=1131366&r2=1131367&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
(original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
Sat Jun  4 10:30:19 2011
@@ -207,6 +207,13 @@ public class TestDocValuesIndexing exten
     case INTS:  
       assertEquals(msg, valuesPerIndex-1, vE_2_merged.advance(valuesPerIndex-1));
     }
+//    switch (first) { // these variants don't advance over missing values
+//  case BYTES_FIXED_STRAIGHT:
+//  case FLOAT_32:
+//  case FLOAT_64:
+//  case INTS:  
+//    assertEquals(msg, valuesPerIndex-1, vE_1_merged.advance(valuesPerIndex-1));
+//  }
     
     for (int i = 0; i < valuesPerIndex; i++) {
       assertEquals(msg, i, vE_1.nextDoc());
@@ -385,17 +392,9 @@ public class TestDocValuesIndexing exten
           assertEquals(0, br.length);
           // make sure we advance at least until base
           ValuesEnum bytesEnum = getValuesEnum(bytesReader);
-          try {
-          
           final int advancedTo = bytesEnum.advance(0);
           assertTrue(byteIndexValue.name() + " advanced failed base:" + base
               + " advancedTo: " + advancedTo, base <= advancedTo);
-          }catch(Throwable e) {
-            final int advancedTo = bytesEnum.advance(0);
-            assertTrue(byteIndexValue.name() + " advanced failed base:" + base
-                + " advancedTo: " + advancedTo, base <= advancedTo);
-
-          }
         }
       }
 



Mime
View raw message