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
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ Optimizations
* GITHUB#15151: Use `SimScorer#score` bulk API to compute impact scores per
block of postings. (Adrien Grand)

* GITHUB#15128: Skip heavy TreeSet opts for the first group in FirstPassGroupingCollector (Binlong Gao)

Bug Fixes
---------------------
* GITHUB#14161: PointInSetQuery's constructor now throws IllegalArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,19 @@ public void collect(int doc) throws IOException {
}
}

// Remove before updating the group since lookup is done via comparators
// TODO: optimize this

final CollectedSearchGroup<T> prevLast;
boolean skipHeavyOps = false;

if (orderedGroups != null) {
prevLast = orderedGroups.last();
orderedGroups.remove(group);
assert orderedGroups.size() == topNGroups - 1;

// Skip remove/add for first group
if (group == orderedGroups.first()) {
skipHeavyOps = true;
} else {
orderedGroups.remove(group);
assert orderedGroups.size() == topNGroups - 1;
}
} else {
prevLast = null;
}
Expand All @@ -307,9 +312,11 @@ public void collect(int doc) throws IOException {
spareSlot = group.comparatorSlot;
group.comparatorSlot = tmp;

// Re-add the changed group
// Re-add only if we removed it
if (orderedGroups != null) {
orderedGroups.add(group);
if (!skipHeavyOps) {
orderedGroups.add(group);
}
assert orderedGroups.size() == topNGroups;
final CollectedSearchGroup<?> newLast = orderedGroups.last();
// If we changed the value of the last group, or changed which group was last, then update
Expand Down
Loading