LUCENE-9416: fix CheckIndex to print an invalid non-zero norm as unsigned long when detecting corruption

This commit is contained in:
Mike McCandless 2020-07-29 10:04:33 -04:00
parent 2f155aa0c3
commit 327d860a00
2 changed files with 4 additions and 1 deletions

View File

@ -175,6 +175,9 @@ Improvements
per hit in dependencies, ExpressionFunctionValues will no longer
recompute already computed values (Haoyu Zhai)
* LUCENE-9416: Fix CheckIndex to print an invalid non-zero norm as
unsigned long when detecting corruption.
Optimizations
---------------------
(No changes)

View File

@ -1671,7 +1671,7 @@ public final class CheckIndex implements Closeable {
}
final long norm = norms.longValue();
if (norm != 0 && visitedDocs.get(doc) == false) {
throw new RuntimeException("Document " + doc + " doesn't have terms according to postings but has a norm value that is not zero: " + norm);
throw new RuntimeException("Document " + doc + " doesn't have terms according to postings but has a norm value that is not zero: " + Long.toUnsignedString(norm));
} else if (norm == 0 && visitedDocs.get(doc)) {
throw new RuntimeException("Document " + doc + " has terms according to postings but its norm value is 0, which may only be used on documents that have no terms");
}