grouping tests of case where no docs match main query. written while trying to repro SOLR-4164, but something is still missing

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1421505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2012-12-13 20:38:52 +00:00
parent 43f36a5750
commit 92176fce6e
2 changed files with 40 additions and 0 deletions

View File

@ -175,6 +175,18 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {
"group.query", t1 + ":this_will_never_match",
"group.limit", 10, "sort", i1 + " asc, id asc");
// SOLR-4164: main query matches nothing, or only matches on one shard
query("q", "bogus_s:nothing", // no docs match
"group", "true",
"group.query", t1 + ":this_will_never_match",
"group.field", i1,
"fl", "id", "group.limit", "2", "group.format", "simple");
query("q", "id:5", // one doc matches, so only one shard
"rows", 100, "fl", "id," + i1, "group", "true",
"group.query", t1 + ":kings OR " + t1 + ":eggs",
"group.field", i1,
"group.limit", 10, "sort", i1 + " asc, id asc");
// SOLR-3109
query("q", t1 + ":eggs", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", 10, "sort", tlong + " asc, id asc");
query("q", i1 + ":232", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", 10, "sort", tlong + " asc, id asc");

View File

@ -585,6 +585,34 @@ public class TestGroupingSearch extends SolrTestCaseJ4 {
, "/grouped/foo_i=={'matches':10,'doclist':"
+ "{'numFound':10,'start':1,'docs':[{'id':'10'},{'id':'3'},{'id':'6'}]}}"
);
//////////////////////// grouping where main query matches nothing
assertJQ(req("fq", filt, "q", "bogus_s:nothing", "group", "true", "group.field", f, "fl", "id", "group.limit", "2", "group.format", "simple")
, "/grouped/foo_i=={'matches':0,'doclist':{'numFound':0,'start':0,'docs':[]}}"
);
assertJQ(req("fq",filt, "q","bogus_s:nothing", "group","true",
"group.query","id:[2 TO 5]",
"group.query","id:[5 TO 5]",
"group.field",f,
"rows","1",
"fl","id", "group.limit","2")
,"/grouped/id:[2 TO 5]=={'matches':0,'doclist':{'numFound':0,'start':0,'docs':[]}}"
,"/grouped/id:[5 TO 5]=={'matches':0,'doclist':{'numFound':0,'start':0,'docs':[]}}"
,"/grouped/"+f+"=={'matches':0,'groups':[]}"
);
assertJQ(req("fq",filt,
"q","bogus_s:nothing",
"group","true",
"group.query","id:[2 TO 5]",
"group.query","id:1000",
"fl","id",
"group.limit","3")
,"/grouped/id:[2 TO 5]=={'matches':0,'doclist':{'numFound':0,'start':0,'docs':[]}}"
,"/grouped/id:1000=={'matches':0,'doclist':{'numFound':0,'start':0,'docs':[]}}"
);
}