mirror of https://github.com/apache/lucene.git
make CheckIndex a bit more anal about ghost fields
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1166928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
46985446cf
commit
896afc4c01
|
@ -886,6 +886,17 @@ public class CheckIndex {
|
|||
}
|
||||
|
||||
final Terms fieldTerms = fields.terms(field);
|
||||
if (fieldTerms == null) {
|
||||
// Unusual: the FieldsEnum returned a field but
|
||||
// the Terms for that field is null; this should
|
||||
// only happen if it's a ghost field (field with
|
||||
// no terms, eg there used to be terms but all
|
||||
// docs got deleted and then merged away):
|
||||
// make sure TermsEnum is empty:
|
||||
if (fieldsEnum.terms().next() != null) {
|
||||
throw new RuntimeException("Fields.terms(field=" + field + ") returned null yet the field appears to have terms");
|
||||
}
|
||||
} else {
|
||||
if (fieldTerms instanceof BlockTreeTermsReader.FieldReader) {
|
||||
final BlockTreeTermsReader.Stats stats = ((BlockTreeTermsReader.FieldReader) fieldTerms).computeStats();
|
||||
assert stats != null;
|
||||
|
@ -971,6 +982,7 @@ public class CheckIndex {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg("OK [" + status.termCount + " terms; " + status.totFreq + " terms/docs pairs; " + status.totPos + " tokens]");
|
||||
|
||||
|
|
Loading…
Reference in New Issue