SOLR-236: grouping - set bottom on the pq if changed

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1035137 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-11-15 03:57:07 +00:00
parent 7b33f0d80c
commit 63555ce48d
1 changed files with 13 additions and 2 deletions

View File

@ -555,16 +555,27 @@ class TopGroupCollector extends GroupCollector {
// remove before updating the group since lookup is done via comparators // remove before updating the group since lookup is done via comparators
// TODO: optimize this // TODO: optimize this
if (orderedGroups != null)
SearchGroup prevLast = null;
if (orderedGroups != null) {
prevLast = orderedGroups.last();
orderedGroups.remove(group); orderedGroups.remove(group);
}
group.topDoc = docBase + doc; group.topDoc = docBase + doc;
// group.topDocScore = scorer.score(); // group.topDocScore = scorer.score();
int tmp = spareSlot; spareSlot = group.comparatorSlot; group.comparatorSlot=tmp; // swap slots int tmp = spareSlot; spareSlot = group.comparatorSlot; group.comparatorSlot=tmp; // swap slots
// re-add the changed group // re-add the changed group
if (orderedGroups != null) if (orderedGroups != null) {
orderedGroups.add(group); orderedGroups.add(group);
SearchGroup newLast = orderedGroups.last();
// if we changed the value of the last group, or changed which group was last, then update bottom
if (group == newLast || prevLast != newLast) {
for (FieldComparator fc : comparators)
fc.setBottom(newLast.comparatorSlot);
}
}
} }
void buildSet() { void buildSet() {