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/10/24 04:25:02 UTC

svn commit: r1188013 - /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java

Author: rmuir
Date: Mon Oct 24 02:25:02 2011
New Revision: 1188013

URL: http://svn.apache.org/viewvc?rev=1188013&view=rev
Log:
LUCENE-3473: CheckIndex should verify numUniqueTerms == recomputedNumUniqueTerms

Modified:
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java

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=1188013&r1=1188012&r2=1188013&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 Mon Oct 24 02:25:02 2011
@@ -768,6 +768,15 @@ public class CheckIndex {
         is.search(new TermQuery(lastTerm), 1);
       }
 
+      try {
+        long uniqueTermCountAllFields = reader.getUniqueTermCount();
+        if (status.termCount != uniqueTermCountAllFields) {
+          throw new RuntimeException("termCount mismatch " + uniqueTermCountAllFields + " vs " + (status.termCount));
+        }
+      } catch (UnsupportedOperationException ex) {
+        // not supported
+      }
+      
       msg("OK [" + status.termCount + " terms; " + status.totFreq + " terms/docs pairs; " + status.totPos + " tokens]");
 
     } catch (Throwable e) {