SOLR-236: fix bug where numFound was always zero if group.offset and group.limit were both zero.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1065406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2011-01-30 22:26:22 +00:00
parent e7088279f7
commit 146c27063f
1 changed files with 4 additions and 3 deletions

View File

@ -77,10 +77,11 @@ public class Grouping {
int docsToCollect = getMax(off, len, max);
// TODO: implement a DocList impl that doesn't need to start at offset=0
TopDocs topDocs = collector.topDocs(0, docsToCollect);
TopDocs topDocs = collector.topDocs(0, Math.max(docsToCollect,1)); // 0 isn't supported as a valid value
int docsCollected = Math.min(docsToCollect, topDocs.scoreDocs.length);
int ids[] = new int[topDocs.scoreDocs.length];
float[] scores = needScores ? new float[topDocs.scoreDocs.length] : null;
int ids[] = new int[docsCollected];
float[] scores = needScores ? new float[docsCollected] : null;
for (int i=0; i<ids.length; i++) {
ids[i] = topDocs.scoreDocs[i].doc;
if (scores != null)