SOLR-2068: optimize group by string

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1038327 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-11-23 20:33:26 +00:00
parent bcf1dcccbe
commit 2867ab831e
1 changed files with 7 additions and 3 deletions

View File

@ -168,7 +168,7 @@ public class Grouping {
int docsToCollect = getMax(groupOffset, docsPerGroup, maxDoc);
docsToCollect = Math.max(docsToCollect, 1);
if (false && groupBy instanceof StrFieldSource) {
if (groupBy instanceof StrFieldSource) {
collector2 = new Phase2StringGroupCollector(collector, groupBy, context, groupSort, docsToCollect, needScores, offset);
} else {
collector2 = new Phase2GroupCollector(collector, groupBy, context, groupSort, docsToCollect, needScores, offset);
@ -739,8 +739,12 @@ class Phase2StringGroupCollector extends Phase2GroupCollector {
ordSet.clear();
for (SearchGroupDocs group : groupMap.values()) {
int ord = index.binarySearchLookup(((MutableValueStr)group.groupValue).value, spare);
if (ord > 0) {
MutableValueStr gv = (MutableValueStr)group.groupValue;
int ord = 0;
if (gv.exists) {
ord = index.binarySearchLookup(((MutableValueStr)group.groupValue).value, spare);
}
if (ord >= 0) {
int slot = ordSet.put(ord);
groups[slot] = group;
}