From 584d68f2e010187c7586c4be696178263d320a52 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Fri, 29 Oct 2010 14:42:33 +0000 Subject: [PATCH] docs: expand short-circuit explanation git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1028777 13f79535-47bb-0310-9956-ffa450edef68 --- solr/src/java/org/apache/solr/search/Grouping.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/solr/src/java/org/apache/solr/search/Grouping.java b/solr/src/java/org/apache/solr/search/Grouping.java index 84db15e7d67..90eb488086b 100755 --- a/solr/src/java/org/apache/solr/search/Grouping.java +++ b/solr/src/java/org/apache/solr/search/Grouping.java @@ -177,6 +177,11 @@ class TopGroupCollector extends GroupCollector { // if orderedGroups != null, then we already have collected N groups and // can short circuit by comparing this document to the smallest group // without having to even find what group this document belongs to. + // Even if this document belongs to a group in the top N, we know that + // we don't have to update that group. + // + // Downside: if the number of unique groups is very low, this is + // wasted effort as we will most likely be updating an existing group. if (orderedGroups != null) { for (int i = 0;; i++) { final int c = reversed[i] * comparators[i].compareBottom(doc);