LUCENE-6220: Fix ArrayStoreException in grouping tests.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1657921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2015-02-06 18:52:20 +00:00
parent 870918702c
commit bd3753e965
1 changed files with 8 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import org.apache.lucene.search.FieldDoc;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TopFieldDocs;
import org.apache.lucene.search.grouping.GroupDocs;
import org.apache.lucene.search.grouping.TopGroups;
import org.apache.lucene.util.BytesRef;
@ -141,7 +142,13 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
}
scoreDocs[j++] = new ShardDoc(score, sortValues, uniqueId, shard);
}
result.put(key, new QueryCommandResult(new TopDocs(totalHits, scoreDocs, maxScore), matches));
final TopDocs topDocs;
if (sortWithinGroup == null) {
topDocs = new TopDocs(totalHits, scoreDocs, maxScore);
} else {
topDocs = new TopFieldDocs(totalHits, scoreDocs, sortWithinGroup.getSort(), maxScore);
}
result.put(key, new QueryCommandResult(topDocs, matches));
continue;
}