Specialize `BlockImpactsDocsEnum#nextDoc()`. (#12670)

When we initially introduced support for dynamic pruning, we had an
implementation of WAND that would almost exclusively use `advance()`. Now that
we switched to MAXSCORE and rely much more on `nextDoc()`, it makes sense to
specialize nextDoc() as well.
This commit is contained in:
Adrien Grand 2023-10-17 14:13:40 +02:00 committed by GitHub
parent f055ac6e16
commit 218eddec70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -1183,13 +1183,23 @@ public final class Lucene90PostingsReader extends PostingsReaderBase {
@Override
public Impacts getImpacts() throws IOException {
// nextDoc() doesn't advance skip lists, so it's important to do it here to make sure we're
// not returning impacts over a bigger range of doc IDs than necessary.
advanceShallow(doc);
return skipper.getImpacts();
}
@Override
public int nextDoc() throws IOException {
return advance(doc + 1);
if (docBufferUpto == BLOCK_SIZE) {
if (seekTo >= 0) {
docIn.seek(seekTo);
isFreqsRead = true; // reset isFreqsRead
seekTo = -1;
}
refillDocs();
}
return this.doc = (int) docBuffer[docBufferUpto++];
}
@Override