From fffce11f1a8c0c53d2e645258ec2db650ef158bb Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Mon, 15 Nov 2010 00:55:57 +0000 Subject: [PATCH] SOLR-236: grouping - fix collectors when sort != group.sort git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1035115 13f79535-47bb-0310-9956-ffa450edef68 --- solr/src/java/org/apache/solr/search/Grouping.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/solr/src/java/org/apache/solr/search/Grouping.java b/solr/src/java/org/apache/solr/search/Grouping.java index f8dc1f5e92d..9d75350108b 100755 --- a/solr/src/java/org/apache/solr/search/Grouping.java +++ b/solr/src/java/org/apache/solr/search/Grouping.java @@ -679,16 +679,16 @@ class TopGroupSortCollector extends TopGroupCollector { buildSet(); } - SearchGroup leastSignificantGroup = orderedGroups.last(); + // see if this new group would be competitive if this doc was the top doc for (int i = 0;; i++) { - final int c = leastSignificantGroup.sortGroupReversed[i] * leastSignificantGroup.sortGroupComparators[i].compareBottom(doc); + final int c = reversed[i] * comparators[i].compareBottom(doc); if (c < 0) { - // Definitely not competitive. + // Definitely not competitive. So don't even bother to continue return; } else if (c > 0) { // Definitely competitive. break; - } else if (i == leastSignificantGroup.sortGroupComparators.length - 1) { + } else if (i == comparators.length - 1) { // Here c=0. If we're at the last comparator, this doc is not // competitive, since docs are visited in doc Id order, which means // this doc cannot compete with any other document in the queue.