Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private static class BulkScorerAndNext {
this.scorers =
PriorityQueue.usingComparator(scorers.size(), Comparator.comparingInt(b -> b.next));
for (BulkScorer scorer : scorers) {
this.scorers.add(new BulkScorerAndNext(scorer));
this.scorers.addNoShift(new BulkScorerAndNext(scorer));
}
}

Expand Down Expand Up @@ -85,7 +85,7 @@ public void setScorer(Scorable scorer) throws IOException {
@Override
public void collect(int doc) throws IOException {
final int delta = doc - windowMin;
windowMatches.set(doc - windowMin);
windowMatches.set(delta);
windowScores[delta] = Math.max(windowScores[delta], scorer.score());
}
},
Expand Down
12 changes: 12 additions & 0 deletions lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ public final T add(T element) {
return heap[1];
}

/**
* Adds an Object to a PriorityQueue without upHeap. Note: only use it when all elements have a
* same value.
Comment on lines +193 to +194
*/
public final void addNoShift(T element) {
// TODO: Check element equalsTo lastElement, if we can get the comparator.

int index = size + 1;
Comment on lines +197 to +199
heap[index] = element;
size = index;
}

/**
* Adds an Object to a PriorityQueue in log(size) time. It returns the object (if any) that was
* dropped off the heap because it was full. This can be the given parameter (in case it is
Expand Down
Loading