add checks

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5178@1515605 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-08-19 21:08:42 +00:00
parent 28316a161c
commit 863c219122
1 changed files with 26 additions and 0 deletions

View File

@ -608,6 +608,32 @@ public class AssertingAtomicReader extends FilterAtomicReader {
}
}
@Override
public Bits getLiveDocs() {
Bits liveDocs = super.getLiveDocs();
if (liveDocs != null) {
assert maxDoc() == liveDocs.length();
} else {
assert maxDoc() == numDocs();
assert !hasDeletions();
}
return liveDocs;
}
@Override
public Bits getDocsWithField(String field) throws IOException {
Bits docsWithField = super.getDocsWithField(field);
FieldInfo fi = getFieldInfos().fieldInfo(field);
if (docsWithField != null) {
assert fi != null;
assert fi.hasDocValues();
assert maxDoc() == docsWithField.length();
} else {
assert fi == null || fi.hasDocValues() == false;
}
return docsWithField;
}
// this is the same hack as FCInvisible
@Override
public Object getCoreCacheKey() {