mirror of https://github.com/apache/lucene.git
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:
parent
7b33f0d80c
commit
63555ce48d
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue