mirror of https://github.com/apache/lucene.git
LUCENE-6271: fix bug in CheckIndex: don't ask for offsets from postings if they didn't have them
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0565536b7f
commit
4a1d1c7c31
|
@ -1898,12 +1898,15 @@ public class CheckIndex implements Closeable {
|
||||||
BytesRef term = null;
|
BytesRef term = null;
|
||||||
while ((term = termsEnum.next()) != null) {
|
while ((term = termsEnum.next()) != null) {
|
||||||
|
|
||||||
|
// This is the term vectors:
|
||||||
postings = termsEnum.postings(null, postings, PostingsEnum.ALL);
|
postings = termsEnum.postings(null, postings, PostingsEnum.ALL);
|
||||||
assert postings != null;
|
assert postings != null;
|
||||||
|
|
||||||
if (!postingsTermsEnum.seekExact(term)) {
|
if (!postingsTermsEnum.seekExact(term)) {
|
||||||
throw new RuntimeException("vector term=" + term + " field=" + field + " does not exist in postings; doc=" + j);
|
throw new RuntimeException("vector term=" + term + " field=" + field + " does not exist in postings; doc=" + j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is the inverted index ("real" postings):
|
||||||
postingsDocs2 = postingsTermsEnum.postings(null, postingsDocs2, PostingsEnum.ALL);
|
postingsDocs2 = postingsTermsEnum.postings(null, postingsDocs2, PostingsEnum.ALL);
|
||||||
assert postingsDocs2 != null;
|
assert postingsDocs2 != null;
|
||||||
|
|
||||||
|
@ -1925,6 +1928,7 @@ public class CheckIndex implements Closeable {
|
||||||
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": freq=" + tf + " differs from postings freq=" + postingsDocs2.freq());
|
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": freq=" + tf + " differs from postings freq=" + postingsDocs2.freq());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Term vectors has prox?
|
||||||
if (hasProx) {
|
if (hasProx) {
|
||||||
for (int i = 0; i < tf; i++) {
|
for (int i = 0; i < tf; i++) {
|
||||||
int pos = postings.nextPosition();
|
int pos = postings.nextPosition();
|
||||||
|
@ -1950,14 +1954,16 @@ public class CheckIndex implements Closeable {
|
||||||
lastStartOffset = startOffset;
|
lastStartOffset = startOffset;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final int postingsStartOffset = postingsDocs2.startOffset();
|
if (startOffset != -1 && endOffset != -1 && postingsTerms.hasOffsets()) {
|
||||||
final int postingsEndOffset = postingsDocs2.endOffset();
|
int postingsStartOffset = postingsDocs2.startOffset();
|
||||||
if (startOffset != -1 && postingsStartOffset != -1 && startOffset != postingsStartOffset) {
|
int postingsEndOffset = postingsDocs2.endOffset();
|
||||||
|
if (startOffset != postingsStartOffset) {
|
||||||
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": startOffset=" + startOffset + " differs from postings startOffset=" + postingsStartOffset);
|
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": startOffset=" + startOffset + " differs from postings startOffset=" + postingsStartOffset);
|
||||||
}
|
}
|
||||||
if (endOffset != -1 && postingsEndOffset != -1 && endOffset != postingsEndOffset) {
|
if (endOffset != postingsEndOffset) {
|
||||||
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": endOffset=" + endOffset + " differs from postings endOffset=" + postingsEndOffset);
|
throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + ": endOffset=" + endOffset + " differs from postings endOffset=" + postingsEndOffset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BytesRef payload = postings.getPayload();
|
BytesRef payload = postings.getPayload();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue