You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/07/17 13:03:15 UTC

svn commit: r1147579 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ lucene/backwards/src/test-framework/ lucene/backwards/src/test/ lucene/src/java/org/apache/lucene/index/ lucene/src/test/org/apache/lucene/index/ solr/

Author: rmuir
Date: Sun Jul 17 11:03:14 2011
New Revision: 1147579

URL: http://svn.apache.org/viewvc?rev=1147579&view=rev
Log:
LUCENE-3224: checkindex fails if docfreq >= skipInterval and term is indexed more than once at same position

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test-framework/   (props changed)
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1147579&r1=1147578&r2=1147579&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Sun Jul 17 11:03:14 2011
@@ -18,6 +18,10 @@ Bug fixes
   causing the file to sometimes be larger than it needed to be.  (Mike
   McCandless)
 
+* LUCENE-3224: Fixed a big where CheckIndex would incorrectly report a
+  corrupt index if a term with docfreq >= 16 was indexed more than once
+  at the same position.  (Robert Muir)
+
 New Features
 
 * LUCENE-3290: Added FieldInvertState.numUniqueTerms 

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java?rev=1147579&r1=1147578&r2=1147579&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java Sun Jul 17 11:03:14 2011
@@ -733,11 +733,8 @@ public class CheckIndex {
                   throw new RuntimeException("position " + pos + " is out of bounds");
                 }
                 // TODO: we should assert when all pos == 0 that positions are actually omitted
-                // previously CI relied upon the fact that freq = 1 always for omitTF
-                if (!(pos == 0 && lastPosition <= 0)) {
-                  if (pos <= lastPosition) {
-                    throw new RuntimeException("position " + pos + " is <= lastPosition " + lastPosition);
-                  }
+                if (pos < lastPosition) {
+                  throw new RuntimeException("position " + pos + " is < lastPosition " + lastPosition);
                 }
                 lastPosition = pos;
               } 

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java?rev=1147579&r1=1147578&r2=1147579&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java Sun Jul 17 11:03:14 2011
@@ -47,6 +47,22 @@ public class TestSameTokenSamePosition e
     riw.close();
     dir.close();
   }
+  
+  /**
+   * Same as the above, but with more docs
+   */
+  public void testMoreDocs() throws Exception {
+    Directory dir = newDirectory();
+    RandomIndexWriter riw = new RandomIndexWriter(random, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new BugReproAnalyzer()));
+    Document doc = new Document();
+    doc.add(new Field("eng", "Six drunken" /*This shouldn't matter. */, 
+                      Field.Store.YES, Field.Index.ANALYZED));
+    for (int i = 0; i < 100; i++) {
+      riw.addDocument(doc);
+    }
+    riw.close();
+    dir.close();
+  }
 }
 
 final class BugReproAnalyzer extends Analyzer{