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 @Override
public DocIdSetIterator iterator() { public DocIdSetIterator iterator() {
final DocIdSetIterator superDISI = super.iterator(); DocIdSetIterator superIterator = super.iterator();
return new DocIdSetIterator() { return new DocIdSetIterator() {
@Override @Override
public int docID() { public int docID() {
return superDISI.docID(); return superIterator.docID();
} }
@Override @Override
public int nextDoc() throws IOException { public int nextDoc() throws IOException {
int docid = superDISI.nextDoc(); return collectAndReturn(superIterator.nextDoc());
if (docid != NO_MORE_DOCS) {
attrCollector.collectScorerAttribution(docid, queryId);
}
return docid;
} }
@Override @Override
public int advance(int target) throws IOException { public int advance(int target) throws IOException {
int docid = superDISI.advance(target); return collectAndReturn(superIterator.advance(target));
if (docid != NO_MORE_DOCS) {
attrCollector.collectScorerAttribution(docid, queryId);
}
return docid;
} }
@Override @Override
public long cost() { public long cost() {
return superDISI.cost(); return superIterator.cost();
}
private int collectAndReturn(int docId) {
if (docId != NO_MORE_DOCS) {
attrCollector.collectScorerAttribution(docId, queryId);
} }
}; };
} }