Skip to content

Instantly share code, notes, and snippets.

@unicolet unicolet/
Created Nov 3, 2017

What would you like to do?
public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
final float score = score();
final int maxDoc = context.reader().maxDoc();
return new BulkScorer() {
public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException {
max = Math.min(max, maxDoc);
FakeScorer scorer = new FakeScorer();
scorer.score = score;
for (int doc = min; doc < max; ++doc) {
scorer.doc = doc;
if (acceptDocs == null || acceptDocs.get(doc)) {
return max == maxDoc ? DocIdSetIterator.NO_MORE_DOCS : max;
public long cost() {
return maxDoc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.