lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1436764 - in /lucene/dev/branches/branch_4x/lucene/core/src: java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java test/org/apache/lucene/index/TestTermVectorsReader.java
Date Tue, 22 Jan 2013 06:50:18 GMT
Author: rmuir
Date: Tue Jan 22 06:50:17 2013
New Revision: 1436764

URL: http://svn.apache.org/viewvc?rev=1436764&view=rev
Log:
LUCENE-4599: fix Compressing vectors to not return a docsAndPositions when it has no prox

Modified:
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java?rev=1436764&r1=1436763&r2=1436764&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java
Tue Jan 22 06:50:17 2013
@@ -873,22 +873,7 @@ public final class CompressingTermVector
     }
 
     @Override
-    public DocsEnum docs(Bits liveDocs, DocsEnum reuse, int flags)
-        throws IOException {
-      return docsAndPositions(liveDocs, reuse, flags);
-    }
-
-    @Override
-    public DocsAndPositionsEnum docsAndPositions(Bits liveDocs,
-        DocsAndPositionsEnum reuse, int flags) throws IOException {
-      if ((flags & POSITIONS) == 0 && (flags & OFFSETS) == 0) {
-        return null;
-      }
-      return docsAndPositions(liveDocs, (DocsEnum) reuse, flags);
-    }
-
-    private DocsAndPositionsEnum docsAndPositions(Bits liveDocs,
-        DocsEnum reuse, int ignoredFlags) throws IOException {
+    public final DocsEnum docs(Bits liveDocs, DocsEnum reuse, int flags) throws IOException
{
       final TVDocsEnum docsEnum;
       if (reuse != null && reuse instanceof TVDocsEnum) {
         docsEnum = (TVDocsEnum) reuse;
@@ -900,6 +885,15 @@ public final class CompressingTermVector
       return docsEnum;
     }
 
+    @Override
+    public DocsAndPositionsEnum docsAndPositions(Bits liveDocs, DocsAndPositionsEnum reuse,
int flags) throws IOException {
+      if (positions == null && startOffsets == null) {
+        return null;
+      }
+      // TODO: slightly sheisty
+      return (DocsAndPositionsEnum) docs(liveDocs, reuse, flags);
+    }
+
   }
 
   private static class TVDocsEnum extends DocsAndPositionsEnum {

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java?rev=1436764&r1=1436763&r2=1436764&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java
Tue Jan 22 06:50:17 2013
@@ -289,6 +289,8 @@ public class TestTermVectorsReader exten
       String term = text.utf8ToString();
       //System.out.println("Term: " + term);
       assertEquals(testTerms[i], term);
+      assertNotNull(termsEnum.docs(null, null));
+      assertNull(termsEnum.docsAndPositions(null, null)); // no pos
     }
     reader.close();
   }



Mime
View raw message