mirror of https://github.com/apache/lucene.git
LUCENE-9620: Implement AssertingWeight#count.
This commit is contained in:
parent
4bb018e904
commit
b3ce44cd0d
|
@ -33,6 +33,15 @@ class AssertingWeight extends FilterWeight {
|
|||
this.scoreMode = scoreMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(LeafReaderContext context) throws IOException {
|
||||
final int count = in.count(context);
|
||||
if (count < -1 || count > context.reader().numDocs()) {
|
||||
throw new AssertionError("count=" + count + ", numDocs=" + context.reader().numDocs());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Matches matches(LeafReaderContext context, int doc) throws IOException {
|
||||
Matches matches = in.matches(context, doc);
|
||||
|
|
Loading…
Reference in New Issue