You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2011/04/07 12:57:18 UTC
svn commit: r1089818 -
/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/CheckIndex.java
Author: mikemccand
Date: Thu Apr 7 10:57:18 2011
New Revision: 1089818
URL: http://svn.apache.org/viewvc?rev=1089818&view=rev
Log:
fix CheckIndex's skip checking to also call nextPosition()
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=1089818&r1=1089817&r2=1089818&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 Thu Apr 7 10:57:18 2011
@@ -659,10 +659,27 @@ public class CheckIndex {
if (!termPositions.skipTo(skipDocID)) {
break;
} else {
+
final int docID = termPositions.doc();
if (docID < skipDocID) {
throw new RuntimeException("term " + term + ": skipTo(docID=" + skipDocID + ") returned docID=" + docID);
}
+ final int freq = termPositions.freq();
+ if (freq <= 0) {
+ throw new RuntimeException("termFreq " + freq + " is out of bounds");
+ }
+ int lastPosition = -1;
+ for(int posUpto=0;posUpto<freq;posUpto++) {
+ final int pos = termPositions.nextPosition();
+ if (pos < 0) {
+ throw new RuntimeException("position " + pos + " is out of bounds");
+ }
+ if (pos <= lastPosition) {
+ throw new RuntimeException("position " + pos + " is <= lastPosition " + lastPosition);
+ }
+ lastPosition = pos;
+ }
+
if (!termPositions.next()) {
break;
}