mirror of
https://github.com/apache/lucene.git
synced 2025-03-06 16:29:30 +00:00
LUCENE-3580: add check to AssertingIndexSearcher that scorers obey DISI contract before next/advance
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1203206 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4597d97e68
commit
4548a5d3a3
@ -76,7 +76,18 @@ public class AssertingIndexSearcher extends IndexSearcher {
|
|||||||
@Override
|
@Override
|
||||||
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
|
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
|
||||||
boolean topScorer, Bits acceptDocs) throws IOException {
|
boolean topScorer, Bits acceptDocs) throws IOException {
|
||||||
return w.scorer(context, scoreDocsInOrder, topScorer, acceptDocs);
|
Scorer scorer = w.scorer(context, scoreDocsInOrder, topScorer, acceptDocs);
|
||||||
|
if (scorer != null) {
|
||||||
|
// check that scorer obeys disi contract for docID() before next()/advance
|
||||||
|
try {
|
||||||
|
int docid = scorer.docID();
|
||||||
|
assert docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS;
|
||||||
|
} catch (UnsupportedOperationException ignored) {
|
||||||
|
// from a top-level BS1
|
||||||
|
assert topScorer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return scorer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user