mirror of https://github.com/apache/lucene.git
LUCENE-3576: check that the order of terms is correct in checkindex
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1232656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d159f25b63
commit
ff5b709b3a
|
@ -1341,10 +1341,23 @@ public class CheckIndex {
|
|||
long tfvComputedTermCountForField = 0;
|
||||
long tfvComputedSumTotalTermFreq = 0;
|
||||
|
||||
BytesRef lastTerm = null;
|
||||
Comparator<BytesRef> termComp = terms.getComparator();
|
||||
BytesRef term = null;
|
||||
while ((term = termsEnum.next()) != null) {
|
||||
tfvComputedTermCountForField++;
|
||||
|
||||
// make sure terms arrive in order according to
|
||||
// the comp
|
||||
if (lastTerm == null) {
|
||||
lastTerm = BytesRef.deepCopyOf(term);
|
||||
} else {
|
||||
if (termComp.compare(lastTerm, term) >= 0) {
|
||||
throw new RuntimeException("vector terms out of order for doc " + j + ": lastTerm=" + lastTerm + " term=" + term);
|
||||
}
|
||||
lastTerm.copyBytes(term);
|
||||
}
|
||||
|
||||
if (termsEnum.docFreq() != 1) {
|
||||
throw new RuntimeException("vector docFreq for doc " + j + ", field " + field + ", term" + term + " != 1");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue