Update IdentifiableQueryScorer.java

This commit is contained in:
aevitas 2023-04-01 13:11:45 +02:00 committed by GitHub
parent d4245582a7
commit e15f5a1b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,35 +25,32 @@ public class IdentifiableQueryScorer extends FilteredScorer {
@Override
public DocIdSetIterator iterator() {
final DocIdSetIterator superDISI = super.iterator();
DocIdSetIterator superIterator = super.iterator();
return new DocIdSetIterator() {
@Override
public int docID() {
return superDISI.docID();
return superIterator.docID();
}
@Override
public int nextDoc() throws IOException {
int docid = superDISI.nextDoc();
if (docid != NO_MORE_DOCS) {
attrCollector.collectScorerAttribution(docid, queryId);
}
return docid;
return collectAndReturn(superIterator.nextDoc());
}
@Override
public int advance(int target) throws IOException {
int docid = superDISI.advance(target);
if (docid != NO_MORE_DOCS) {
attrCollector.collectScorerAttribution(docid, queryId);
}
return docid;
return collectAndReturn(superIterator.advance(target));
}
@Override
public long cost() {
return superDISI.cost();
return superIterator.cost();
}
private int collectAndReturn(int docId) {
if (docId != NO_MORE_DOCS) {
attrCollector.collectScorerAttribution(docId, queryId);
}
};
}