mirror of https://github.com/apache/lucene.git
SOLR-2564: Fixed ArrayIndexOutOfBoundsException when using simple format
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1145173 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d63bce7fe
commit
8445d20f5d
|
@ -585,7 +585,7 @@ public class Grouping {
|
|||
}
|
||||
}
|
||||
|
||||
int len = Math.min(numGroups, docsGathered);
|
||||
int len = docsGathered - offset;
|
||||
if (offset > len) {
|
||||
len = 0;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,22 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {
|
|||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGroupingSimpleFormatArrayIndexOutOfBoundsException() throws Exception {
|
||||
assertU(add(doc("id", "1")));
|
||||
assertU(add(doc("id", "2")));
|
||||
assertU(add(doc("id", "3")));
|
||||
assertU(commit());
|
||||
|
||||
assertJQ(
|
||||
req("q", "*:*", "start", "1", "group", "true", "group.field", "id", "group.main", "true"),
|
||||
"/response=={'numFound':3,'start':1,'docs':[{'id':'2'},{'id':'3'}]}"
|
||||
);
|
||||
assertJQ(
|
||||
req("q", "*:*", "start", "1", "rows", "1", "group", "true", "group.field", "id", "group.main", "true"),
|
||||
"/response=={'numFound':3,'start':1,'docs':[{'id':'2'}]}"
|
||||
);
|
||||
}
|
||||
|
||||
static String f = "foo_i";
|
||||
static String f2 = "foo2_i";
|
||||
|
|
Loading…
Reference in New Issue