lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r652116 - in /lucene/java/trunk/src: java/org/apache/lucene/index/CheckIndex.java java/org/apache/lucene/index/DocumentsWriterFieldData.java test/org/apache/lucene/index/TestIndexWriter.java
Date Tue, 29 Apr 2008 21:01:56 GMT
Author: mikemccand
Date: Tue Apr 29 14:01:55 2008
New Revision: 652116

URL: http://svn.apache.org/viewvc?rev=652116&view=rev
Log:
LUCENE-1255: revert this change (allow pos=-1 again) since it's not backwards compatible

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java
    lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriterFieldData.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java?rev=652116&r1=652115&r2=652116&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java Tue Apr 29 14:01:55
2008
@@ -104,7 +104,6 @@
 
     String sFormat = "";
     boolean skip = false;
-    boolean allowMinusOnePosition = true;
 
     if (format == SegmentInfos.FORMAT)
       sFormat = "FORMAT [Lucene Pre-2.1]";
@@ -118,7 +117,6 @@
       // LUCENE-1255: All versions before 2.3.2/2.4 were
       // able to create position=-1 when the very first
       // Token has positionIncrement 0
-      allowMinusOnePosition = false;
       if (format == SegmentInfos.FORMAT_CHECKSUM)
         sFormat = "FORMAT_CHECKSUM [Lucene 2.4]";
       else if (format == SegmentInfos.FORMAT_DEL_COUNT)
@@ -235,7 +233,7 @@
             totPos += freq;
             for(int j=0;j<freq;j++) {
               final int pos = termPositions.nextPosition();
-              if (pos < -1 || (pos == -1 && !allowMinusOnePosition))
+              if (pos < -1)
                 throw new RuntimeException("term " + term + ": doc " + doc + ": pos " + pos
+ " is out of bounds");
               if (pos < lastPos)
                 throw new RuntimeException("term " + term + ": doc " + doc + ": pos " + pos
+ " < lastPos " + lastPos);

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriterFieldData.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriterFieldData.java?rev=652116&r1=652115&r2=652116&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriterFieldData.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriterFieldData.java Tue Apr
29 14:01:55 2008
@@ -243,9 +243,6 @@
           Token token = stream.next(localToken);
           if (token == null) break;
           position += (token.getPositionIncrement() - 1);
-          // LUCENE-1255: don't allow negative position
-          if (position < 0)
-            position = 0;
           addPosition(token);
           if (++length >= maxFieldLength) {
             if (threadState.docWriter.infoStream != null)

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=652116&r1=652115&r2=652116&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java Tue Apr 29 14:01:55
2008
@@ -3596,7 +3596,7 @@
     TermPositions tps = s.getIndexReader().termPositions(new Term("field", "a"));
     assertTrue(tps.next());
     assertEquals(1, tps.freq());
-    assertEquals(0, tps.nextPosition());
+    assertEquals(-1, tps.nextPosition());
     w.close();
 
     assertTrue(_TestUtil.checkIndex(dir));



Mime
View raw message