diff --git a/solr/core/src/test/org/apache/solr/TestCrossCoreJoin.java b/solr/core/src/test/org/apache/solr/TestCrossCoreJoin.java index 1d8f2308c6b..e88d948e2b3 100644 --- a/solr/core/src/test/org/apache/solr/TestCrossCoreJoin.java +++ b/solr/core/src/test/org/apache/solr/TestCrossCoreJoin.java @@ -151,9 +151,8 @@ void doTestJoin(String joinPrefix) throws Exception { "/response=={'numFound':3,'start':0,'numFoundExact':true,'docs':[{'id':'1'},{'id':'4'},{'id':'5'}]}"); assertJQ( + "/export", req( - "qt", - "/export", "q", joinPrefix + " from=dept_id_s to=dept_s fromIndex=fromCore}cat:dev", "fl", diff --git a/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java index aa2b70c0132..4d99787e09a 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java @@ -118,13 +118,8 @@ public void testFieldType() throws Exception { assertQ( "", - req( - CommonParams.Q, - "AAAA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AAAA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='7']", "//result/doc[2]/str[@name='id'][.='9']", @@ -156,9 +151,9 @@ public void testFq() throws Exception { // elevated docs 1, 2, and 3 are returned even though our query "ZZZZ" doesn't match them assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='1']", @@ -172,9 +167,9 @@ public void testFq() throws Exception { // exclude docs 1 and 3 even though those docs are elevated assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "str_s:b"), "//*[@numFound='1']", @@ -186,9 +181,9 @@ public void testFq() throws Exception { // docs assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1,test2}str_s:b", QueryElevationParams.ELEVATE_EXCLUDE_TAGS, "test3"), @@ -200,9 +195,9 @@ public void testFq() throws Exception { // behavior as above; the filter still takes effect on the elevated docs assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1,test2}str_s:b", QueryElevationParams.ELEVATE_EXCLUDE_TAGS, ","), @@ -215,9 +210,9 @@ public void testFq() throws Exception { // the original filter assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1,test2}str_s:b", QueryElevationParams.ELEVATE_EXCLUDE_TAGS, "test0,test2,test4"), @@ -233,9 +228,9 @@ public void testFq() throws Exception { // this case, the main query); nor does including empty values in the list of tags to exclude assertQ( "", + "/elevate", req( CommonParams.Q, "{!tag=test0}ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1,test1,test2,test2}str_s:b", QueryElevationParams.ELEVATE_EXCLUDE_TAGS, "test0,test0,test2,test2,test4,test4,,,"), @@ -250,9 +245,9 @@ public void testFq() throws Exception { // we can exclude some filters while leaving others in place assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1}id:10", CommonParams.FQ, "{!tag=test2}str_s:b", @@ -265,9 +260,9 @@ public void testFq() throws Exception { // when filters are marked as cache=false, tag exclusion works the same as before assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1 cache=false}id:10", CommonParams.FQ, "{!tag=test2 cache=false}str_s:b", @@ -280,9 +275,9 @@ public void testFq() throws Exception { // we can apply the same tag to two different filters assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1}id:10", CommonParams.FQ, "{!tag=test2}str_s:b", @@ -295,9 +290,9 @@ public void testFq() throws Exception { // we can use filter() syntax inside fq's that are tagged for exclusion assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1}+filter(id:10) +filter(id:11)", CommonParams.FQ, "{!tag=test2}filter(str_s:b)", @@ -310,9 +305,9 @@ public void testFq() throws Exception { // if we search for MMMM we should get one match; no documents are elevated for this query assertQ( "", + "/elevate", req( CommonParams.Q, "MMMM", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='1']", "//result/doc[1]/str[@name='id'][.='4']", @@ -321,9 +316,9 @@ public void testFq() throws Exception { // if we add fq=str_s:b, our one document that matches MMMM will be filtered out assertQ( "", + "/elevate", req( CommonParams.Q, "MMMM", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "str_s:b"), "//*[@numFound='0']"); @@ -333,9 +328,9 @@ public void testFq() throws Exception { // subject to the filter assertQ( "", + "/elevate", req( CommonParams.Q, "MMMM", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!tag=test1}str_s:b", QueryElevationParams.ELEVATE_EXCLUDE_TAGS, "test1"), @@ -345,9 +340,9 @@ public void testFq() throws Exception { // excluded; first, confirm that when collapsing, all elevated docs are visible by default assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!collapse field=str_s sort='score desc'}"), "//*[@numFound='3']", @@ -361,9 +356,9 @@ public void testFq() throws Exception { // when collapsing, an added filter has the expected effect assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!collapse field=str_s sort='score desc'}", CommonParams.FQ, "str_s:b"), @@ -375,9 +370,9 @@ public void testFq() throws Exception { // elevated documents assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!collapse field=str_s sort='score desc'}", CommonParams.FQ, "{!tag=test1}str_s:b", @@ -396,12 +391,12 @@ public void testFq() throws Exception { "tagging a collapse filter for exclusion should lead to a BAD_REQUEST", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!collapse tag=test1 field=str_s sort='score desc'}", CommonParams.FQ, "{!tag=test2}str_s:b", QueryElevationParams.ELEVATE_EXCLUDE_TAGS, "test1,test2"), - SolrException.ErrorCode.BAD_REQUEST); + SolrException.ErrorCode.BAD_REQUEST, + "/elevate"); // if a function range query is provided as a filter, it can be tagged for exclusion; // FunctionRangeQuery is special because it implements the PostFilter interface and @@ -410,9 +405,9 @@ public void testFq() throws Exception { // behavior assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "{!frange tag=test1 l=100 cache=false cost=200}5.0", CommonParams.FQ, "{!tag=test2}str_s:b", @@ -454,7 +449,6 @@ public void testFqWithCacheAndCostLocalParams() throws Exception { try (SolrQueryRequest request = req( CommonParams.Q, "ZZZZ1", - CommonParams.QT, "/elevate", CommonParams.DF, "text", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "str_s:A", @@ -524,7 +518,6 @@ public void testFqWithCacheAndCostLocalParams() throws Exception { try (SolrQueryRequest request = req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CommonParams.DF, "text", CommonParams.FL, "id, score, [elevated]", CommonParams.FQ, "str_s:A", @@ -677,9 +670,9 @@ public void testGroupedQuery() throws Exception { assertQ( "non-elevated group query", + "/elevate", req( CommonParams.Q, "AAAA", - CommonParams.QT, "/elevate", GroupParams.GROUP_FIELD, "str_s", GroupParams.GROUP, "true", GroupParams.GROUP_TOTAL_COUNT, "true", @@ -703,9 +696,9 @@ public void testGroupedQuery() throws Exception { assertQ( "elevated group query", + "/elevate", req( CommonParams.Q, "AAAA", - CommonParams.QT, "/elevate", GroupParams.GROUP_FIELD, "str_s", GroupParams.GROUP, "true", GroupParams.GROUP_TOTAL_COUNT, "true", @@ -728,9 +721,9 @@ public void testGroupedQuery() throws Exception { assertQ( "non-elevated because sorted group query", + "/elevate", req( CommonParams.Q, "AAAA", - CommonParams.QT, "/elevate", CommonParams.SORT, "id asc", GroupParams.GROUP_FIELD, "str_s", GroupParams.GROUP, "true", @@ -754,9 +747,9 @@ public void testGroupedQuery() throws Exception { assertQ( "force-elevated sorted group query", + "/elevate", req( CommonParams.Q, "AAAA", - CommonParams.QT, "/elevate", CommonParams.SORT, "id asc", QueryElevationParams.FORCE_ELEVATION, "true", GroupParams.GROUP_FIELD, "str_s", @@ -781,9 +774,9 @@ public void testGroupedQuery() throws Exception { assertQ( "non-elevated because of sort within group query", + "/elevate", req( CommonParams.Q, "AAAA", - CommonParams.QT, "/elevate", CommonParams.SORT, "id asc", GroupParams.GROUP_SORT, "id desc", GroupParams.GROUP_FIELD, "str_s", @@ -808,9 +801,9 @@ public void testGroupedQuery() throws Exception { assertQ( "force elevated sort within sorted group query", + "/elevate", req( CommonParams.Q, "AAAA", - CommonParams.QT, "/elevate", CommonParams.SORT, "id asc", GroupParams.GROUP_SORT, "id desc", QueryElevationParams.FORCE_ELEVATION, "true", @@ -859,13 +852,8 @@ public void testTrieFieldType() throws Exception { assertQ( "", - req( - CommonParams.Q, - "AAAA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AAAA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='7']", "//result/doc[2]/str[@name='id'][.='8']", @@ -933,7 +921,8 @@ public void testInterface() throws Exception { assertQ( "Make sure QEC handles null queries", - req("qt", "/elevate", "q.alt", "*:*", "defType", "dismax"), + "/elevate", + req("q.alt", "*:*", "defType", "dismax"), "//*[@numFound='0']"); } } finally { @@ -957,13 +946,8 @@ public void testMarker() throws Exception { assertQ( "", - req( - CommonParams.Q, - "XXXX", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "XXXX", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='1']", "//result/doc[2]/str[@name='id'][.='4']", @@ -974,26 +958,16 @@ public void testMarker() throws Exception { assertQ( "", - req( - CommonParams.Q, - "AAAA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AAAA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='1']", "//result/doc[1]/str[@name='id'][.='7']", "//result/doc[1]/bool[@name='[elevated]'][.='true']"); assertQ( "", - req( - CommonParams.Q, - "AAAA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elev]"), + "/elevate", + req(CommonParams.Q, "AAAA", CommonParams.FL, "id, score, [elev]"), "//*[@numFound='1']", "//result/doc[1]/str[@name='id'][.='7']", "not(//result/doc[1]/bool[@name='[elevated]'][.='false'])", @@ -1027,11 +1001,10 @@ public void testMarkExcludes() throws Exception { assertQ( "", + "/elevate", req( CommonParams.Q, "XXXX XXXX", - CommonParams.QT, - "/elevate", QueryElevationParams.MARK_EXCLUDES, "true", "indent", @@ -1052,11 +1025,10 @@ public void testMarkExcludes() throws Exception { // thus, number 6 should not be returned, b/c it is excluded assertQ( "", + "/elevate", req( CommonParams.Q, "XXXX XXXX", - CommonParams.QT, - "/elevate", QueryElevationParams.MARK_EXCLUDES, "false", CommonParams.FL, @@ -1075,11 +1047,10 @@ public void testMarkExcludes() throws Exception { // excluded results) assertQ( "", + "/elevate", req( CommonParams.Q, "QQQQ", - CommonParams.QT, - "/elevate", QueryElevationParams.ENABLE, "false", "indent", @@ -1092,11 +1063,10 @@ public void testMarkExcludes() throws Exception { "//result/doc[3]/str[@name='id'][.='8']"); assertQ( "", + "/elevate", req( CommonParams.Q, "QQQQ", - CommonParams.QT, - "/elevate", QueryElevationParams.MARK_EXCLUDES, "true", "indent", @@ -1132,7 +1102,6 @@ public void testSorting() throws Exception { final SolrParams baseParams = params( - "qt", "/elevate", "q", query, "fl", "id,score", "indent", "true"); @@ -1143,6 +1112,7 @@ public void testSorting() throws Exception { assertQ( "Make sure standard sort works as expected", + "/elevate", req(baseParams), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='c']", @@ -1154,6 +1124,7 @@ public void testSorting() throws Exception { assertQ( "All six should make it", + "/elevate", req(baseParams), "//*[@numFound='6']", "//result/doc[1]/str[@name='id'][.='x']", @@ -1166,6 +1137,8 @@ public void testSorting() throws Exception { // now switch the order: booster.setTopQueryResults(reader, query, false, new String[] {"a", "x"}, null); assertQ( + null, + "/elevate", req(baseParams), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='a']", @@ -1177,6 +1150,8 @@ public void testSorting() throws Exception { // default 'forceBoost' should be false assertFalse(booster.forceElevation); assertQ( + null, + "/elevate", req(baseParams, "sort", "id asc"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='a']", @@ -1186,6 +1161,7 @@ public void testSorting() throws Exception { assertQ( "useConfiguredElevatedOrder=false", + "/elevate", req(baseParams, "sort", "str_s1 asc,id desc", "useConfiguredElevatedOrder", "false"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='x']", // group1 @@ -1195,6 +1171,8 @@ public void testSorting() throws Exception { booster.forceElevation = true; assertQ( + null, + "/elevate", req(baseParams, "sort", "id asc"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='a']", @@ -1205,6 +1183,7 @@ public void testSorting() throws Exception { booster.forceElevation = true; assertQ( "useConfiguredElevatedOrder=false and forceElevation", + "/elevate", req(baseParams, "sort", "id desc", "useConfiguredElevatedOrder", "false"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='x']", // force elevated @@ -1215,6 +1194,8 @@ public void testSorting() throws Exception { // Test exclusive (not to be confused with exclusion) booster.setTopQueryResults(reader, query, false, new String[] {"x", "a"}, new String[] {}); assertQ( + null, + "/elevate", req(baseParams, "exclusive", "true"), "//*[@numFound='2']", "//result/doc[1]/str[@name='id'][.='x']", @@ -1223,6 +1204,8 @@ public void testSorting() throws Exception { // Test exclusion booster.setTopQueryResults(reader, query, false, new String[] {"x"}, new String[] {"a"}); assertQ( + null, + "/elevate", req(baseParams), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='x']", @@ -1234,6 +1217,7 @@ public void testSorting() throws Exception { booster.clearElevationProviderCache(); assertQ( "All five should make it", + "/elevate", req(baseParams, "elevateIds", "x,y,z", "excludeIds", "b"), "//*[@numFound='5']", "//result/doc[1]/str[@name='id'][.='x']", @@ -1244,6 +1228,7 @@ public void testSorting() throws Exception { assertQ( "All four should make it", + "/elevate", req(baseParams, "elevateIds", "x,z,y", "excludeIds", "b,c"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='x']", @@ -1363,37 +1348,22 @@ public void testWithLocalParam() throws Exception { assertQ( "", - req( - CommonParams.Q, - "AAAA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AAAA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='1']", "//result/doc[1]/str[@name='id'][.='7']", "//result/doc[1]/bool[@name='[elevated]'][.='true']"); assertQ( "", - req( - CommonParams.Q, - "{!q.op=AND}AAAA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "{!q.op=AND}AAAA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='1']", "//result/doc[1]/str[@name='id'][.='7']", "//result/doc[1]/bool[@name='[elevated]'][.='true']"); assertQ( "", - req( - CommonParams.Q, - "{!q.op=AND v='AAAA'}", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "{!q.op=AND v='AAAA'}", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='1']", "//result/doc[1]/str[@name='id'][.='7']", "//result/doc[1]/bool[@name='[elevated]'][.='true']"); @@ -1425,13 +1395,8 @@ public void testQuerySubsetMatching() throws Exception { // Exact matching. assertQ( "", - req( - CommonParams.Q, - "XXXX", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "XXXX", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='1']", "//result/doc[2]/str[@name='id'][.='4']", @@ -1443,25 +1408,15 @@ public void testQuerySubsetMatching() throws Exception { // Exact matching. assertQ( "", - req( - CommonParams.Q, - "QQQQ EE", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "QQQQ EE", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='0']"); // Subset matching. assertQ( "", - req( - CommonParams.Q, - "BB DD CC VV", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "BB DD CC VV", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='10']", "//result/doc[2]/str[@name='id'][.='12']", @@ -1475,13 +1430,8 @@ public void testQuerySubsetMatching() throws Exception { // Subset + exact matching. assertQ( "", - req( - CommonParams.Q, - "BB CC", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "BB CC", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='13']", "//result/doc[2]/str[@name='id'][.='10']", @@ -1495,13 +1445,8 @@ public void testQuerySubsetMatching() throws Exception { // Subset matching. assertQ( "", - req( - CommonParams.Q, - "AA BB DD CC AA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AA BB DD CC AA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='4']", "//result/doc[1]/str[@name='id'][.='10']", "//result/doc[2]/str[@name='id'][.='12']", @@ -1515,13 +1460,8 @@ public void testQuerySubsetMatching() throws Exception { // Subset matching. assertQ( "", - req( - CommonParams.Q, - "AA RR BB DD AA", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AA RR BB DD AA", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='12']", "//result/doc[2]/str[@name='id'][.='14']", @@ -1533,13 +1473,8 @@ public void testQuerySubsetMatching() throws Exception { // Subset matching. assertQ( "", - req( - CommonParams.Q, - "AA BB EE", - CommonParams.QT, - "/elevate", - CommonParams.FL, - "id, score, [elevated]"), + "/elevate", + req(CommonParams.Q, "AA BB EE", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='0']"); } finally { delete(); @@ -1598,9 +1533,9 @@ public void testOnlyDocsInSearchResultsWillBeElevated() throws Exception { // default behaviour assertQ( "", + "/elevate", req( CommonParams.Q, "YYYY", - CommonParams.QT, "/elevate", QueryElevationParams.ELEVATE_ONLY_DOCS_MATCHING_QUERY, "false", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='3']", @@ -1614,9 +1549,9 @@ public void testOnlyDocsInSearchResultsWillBeElevated() throws Exception { // only docs that matches q assertQ( "", + "/elevate", req( CommonParams.Q, "YYYY", - CommonParams.QT, "/elevate", QueryElevationParams.ELEVATE_ONLY_DOCS_MATCHING_QUERY, "true", CommonParams.FL, "id, score, [elevated]"), "//*[@numFound='2']", @@ -1644,9 +1579,9 @@ public void testOnlyRepresentativeIsVisibleWhenCollapsing() throws Exception { // default behaviour - all elevated docs are visible assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CollapsingQParserPlugin.COLLECT_ELEVATED_DOCS_WHEN_COLLAPSING, "true", CommonParams.FQ, "{!collapse field=str_s1 sort='score desc'}", CommonParams.FL, "id, score, [elevated]"), @@ -1663,9 +1598,9 @@ public void testOnlyRepresentativeIsVisibleWhenCollapsing() throws Exception { // only representative elevated doc visible assertQ( "", + "/elevate", req( CommonParams.Q, "ZZZZ", - CommonParams.QT, "/elevate", CollapsingQParserPlugin.COLLECT_ELEVATED_DOCS_WHEN_COLLAPSING, "false", CommonParams.FQ, "{!collapse field=str_s1 sort='score desc'}", CommonParams.FL, "id, score, [elevated]"), @@ -1698,7 +1633,6 @@ public void testCursor() throws Exception { final SolrParams baseParams = params( - "qt", "/elevate", "q", "title:ipod", "sort", "score desc, id asc", "fl", "id", @@ -1707,12 +1641,14 @@ public void testCursor() throws Exception { // sanity check everything returned w/these elevation options... assertJQ( + "/elevate", req(baseParams), "/response/numFound==5", "/response/start==0", "/response/docs==[{'id':'x'},{'id':'y'},{'id':'z'},{'id':'c'},{'id':'a'}]"); // same query using CURSOR_MARK_START should produce a 'next' cursor... assertCursorJQ( + "/elevate", req(baseParams, CURSOR_MARK_PARAM, CURSOR_MARK_START), "/response/numFound==5", "/response/start==0", @@ -1722,18 +1658,21 @@ public void testCursor() throws Exception { String nextCursor = null; nextCursor = assertCursorJQ( + "/elevate", req(baseParams, CURSOR_MARK_PARAM, CURSOR_MARK_START, "rows", "2"), "/response/numFound==5", "/response/start==0", "/response/docs==[{'id':'x'},{'id':'y'}]"); nextCursor = assertCursorJQ( + "/elevate", req(baseParams, CURSOR_MARK_PARAM, nextCursor, "rows", "2"), "/response/numFound==5", "/response/start==0", "/response/docs==[{'id':'z'},{'id':'c'}]"); nextCursor = assertCursorJQ( + "/elevate", req(baseParams, CURSOR_MARK_PARAM, nextCursor, "rows", "2"), "/response/numFound==5", "/response/start==0", @@ -1741,6 +1680,7 @@ public void testCursor() throws Exception { final String lastCursor = nextCursor; nextCursor = assertCursorJQ( + "/elevate", req(baseParams, CURSOR_MARK_PARAM, nextCursor, "rows", "2"), "/response/numFound==5", "/response/start==0", @@ -1762,8 +1702,9 @@ private static Set toIdSet(String... ids) { * * @see #assertJQ */ - private static String assertCursorJQ(SolrQueryRequest req, String... tests) throws Exception { - String json = assertJQ(req, tests); + private static String assertCursorJQ(String handler, SolrQueryRequest req, String... tests) + throws Exception { + String json = assertJQ(handler, req, tests); Map rsp = (Map) fromJSONString(json); assertTrue( "response doesn't contain " + CURSOR_MARK_NEXT + ": " + json, diff --git a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java index 670a4d8aef2..ba3b557b4ac 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java @@ -227,11 +227,10 @@ public void testCanned() throws Exception { private void doBasics() throws Exception { assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, @@ -246,11 +245,10 @@ private void doBasics() throws Exception { + " 'test_postv':{'anoth':{'tf':1},'titl':{'tf':2}}}}"); // tv.fl diff from fl assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", "fl", @@ -266,11 +264,10 @@ private void doBasics() throws Exception { + " 'test_offtv':{'anoth':{'tf':1},'titl':{'tf':2}}}}"); // multi-valued tv.fl assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", "fl", @@ -288,11 +285,10 @@ private void doBasics() throws Exception { + " 'test_offtv':{'anoth':{'tf':1},'titl':{'tf':2}}}}"); // re-use fl glob assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", "fl", @@ -309,11 +305,10 @@ private void doBasics() throws Exception { + " 'test_postv':{'anoth':{'tf':1},'titl':{'tf':2}}}}"); // re-use fl, ignore things we can't handle assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", "fl", @@ -327,11 +322,10 @@ private void doBasics() throws Exception { + " 'test_postv':{'anoth':{'tf':1},'titl':{'tf':2}}}}"); // re-use (multi-valued) fl, ignore things we can't handle assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", "fl", @@ -349,11 +343,10 @@ private void doBasics() throws Exception { private void doOptions() throws Exception { assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, @@ -371,11 +364,10 @@ private void doOptions() throws Exception { "/termVectors/0/test_posofftv/anoth=={'tf':1, 'offsets':{'start':20, 'end':27}, 'positions':{'position':5}, 'df':2, 'tf-idf':0.5}"); assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, @@ -387,8 +379,7 @@ private void doOptions() throws Exception { // test each combination at random final List list = new ArrayList<>(); list.addAll( - Arrays.asList( - "json.nl", "map", "qt", tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, "true")); + Arrays.asList("json.nl", "map", "q", "id:0", TermVectorComponent.COMPONENT_NAME, "true")); String[][] options = new String[][] { {TermVectorParams.TF, "'tf':1"}, @@ -413,16 +404,15 @@ private void doOptions() throws Exception { } expected.append("}"); - assertJQ(req(list.toArray(new String[0])), expected.toString()); + assertJQ(tv, req(list.toArray(new String[0])), expected.toString()); } private void doPerField() throws Exception { assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, @@ -462,11 +452,10 @@ private void doPayloads() throws Exception { // stuffs start (20) and end offset (27) into the // payload: assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, @@ -498,11 +487,10 @@ public void testNoVectors() throws Exception { // Kind of an odd test, but we just want to know if we don't generate an NPE when there is // nothing to give back in the term vectors. assertJQ( + tv, req( "json.nl", "map", - "qt", - tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, diff --git a/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java index 2870fb222bb..fcd9d93c109 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java @@ -84,7 +84,9 @@ public void createIndex() { @Test public void testEmptyLower() { assertQ( - req("indent", "true", "qt", "/terms", "terms.fl", "lowerfilt", "terms.upper", "b"), + null, + "/terms", + req("indent", "true", "terms.fl", "lowerfilt", "terms.upper", "b"), "count(//lst[@name='lowerfilt']/*)=6", "//int[@name='a'] ", "//int[@name='aa'] ", @@ -97,11 +99,11 @@ public void testEmptyLower() { @Test public void testMultipleFields() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", "terms.upper", @@ -115,15 +117,17 @@ public void testMultipleFields() { @Test public void testUnlimitedRows() { assertQ( - req("indent", "true", "qt", "/terms", "terms.fl", "lowerfilt", "terms.fl", "standardfilt"), + null, + "/terms", + req("indent", "true", "terms.fl", "lowerfilt", "terms.fl", "standardfilt"), "count(//lst[@name='lowerfilt']/*)=9", "count(//lst[@name='standardfilt']/*)=10"); assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", "terms.fl", @@ -137,11 +141,11 @@ public void testUnlimitedRows() { @Test public void testPrefix() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", "terms.upper", @@ -165,11 +169,11 @@ public void testPrefix() { @Test public void testRegexp() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.lower", @@ -219,11 +223,11 @@ public void testRegexpFlagParsing() { public void testRegexpWithFlags() { // TODO: there are no uppercase or mixed-case terms in the index! assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.lower", @@ -244,11 +248,11 @@ public void testRegexpWithFlags() { @Test public void testSortCount() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.lower", @@ -269,11 +273,11 @@ public void testSortCount() { public void testTermsList() { // Terms list always returns in index order assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.list", @@ -287,7 +291,9 @@ public void testTermsList() { // Test with numeric terms assertQ( - req("indent", "true", "qt", "/terms", "terms.fl", "foo_i", "terms.list", "2,1"), + null, + "/terms", + req("indent", "true", "terms.fl", "foo_i", "terms.list", "2,1"), "count(//lst[@name='foo_i']/*)=2", "//lst[@name='foo_i']/int[1][@name='1'][.='2']", "//lst[@name='foo_i']/int[2][@name='2'][.='1']"); @@ -297,11 +303,11 @@ public void testTermsList() { public void testStats() { // Terms list always returns in index order assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.stats", @@ -314,11 +320,11 @@ public void testStats() { @Test public void testSortIndex() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.lower", @@ -338,11 +344,11 @@ public void testSortIndex() { @Test public void testPastUpper() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", // no upper bound, lower bound doesn't exist @@ -354,11 +360,11 @@ public void testPastUpper() { @Test public void testLowerExclusive() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", "terms.lower", @@ -375,11 +381,11 @@ public void testLowerExclusive() { "//int[@name='abc'] "); assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.lower", @@ -394,17 +400,9 @@ public void testLowerExclusive() { @Test public void test() { assertQ( - req( - "indent", - "true", - "qt", - "/terms", - "terms.fl", - "lowerfilt", - "terms.lower", - "a", - "terms.upper", - "b"), + null, + "/terms", + req("indent", "true", "terms.fl", "lowerfilt", "terms.lower", "a", "terms.upper", "b"), "count(//lst[@name='lowerfilt']/*)=6", "//int[@name='a'] ", "//int[@name='aa'] ", @@ -414,11 +412,11 @@ public void test() { "//int[@name='abc'] "); assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", "terms.lower", @@ -433,7 +431,7 @@ public void test() { "//int[@name='a']", "//int[@name='aa']"); - assertQ(req("indent", "true", "qt", "/terms", "terms.fl", "foo_i"), "//int[@name='1'][.='2']"); + assertQ(null, "/terms", req("indent", "true", "terms.fl", "foo_i"), "//int[@name='1'][.='2']"); /* terms.raw only applies to indexed fields assertQ(req("indent","true", "qt","/terms", @@ -444,18 +442,20 @@ public void test() { // check something at the end of the index assertQ( - req("indent", "true", "qt", "/terms", "terms.fl", "zzz_i"), + null, + "/terms", + req("indent", "true", "terms.fl", "zzz_i"), "count(//lst[@name='zzz_i']/*)=0"); } @Test public void testMinMaxFreq() { assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "lowerfilt", "terms.lower", @@ -469,11 +469,11 @@ public void testMinMaxFreq() { "count(//lst[@name='lowerfilt']/*)=1"); assertQ( + null, + "/terms", req( "indent", "true", - "qt", - "/terms", "terms.fl", "standardfilt", "terms.lower", @@ -490,23 +490,14 @@ public void testMinMaxFreq() { @Test public void testTermsWithJSON() throws Exception { ModifiableSolrParams params = - params( - "qt", - "/terms", - "terms.fl", - "standardfilt", - "terms.lower", - "a", - "terms.sort", - "index", - "wt", - "json"); + params("terms.fl", "standardfilt", "terms.lower", "a", "terms.sort", "index", "wt", "json"); - assertJQ(req(params), "/terms/standardfilt/[0]==a", "/terms/standardfilt/[1]==1"); + assertJQ("/terms", req(params), "/terms/standardfilt/[0]==a", "/terms/standardfilt/[1]==1"); // enable terms.ttf params.set("terms.ttf", "true"); assertJQ( + "/terms", req(params), "/terms/standardfilt/[0]==a", "/terms/standardfilt/[1]/df==1", @@ -516,6 +507,7 @@ public void testTermsWithJSON() throws Exception { params.set("terms.list", "spider,snake,shark"); params.remove("terms.ttf"); assertJQ( + "/terms", req(params), "/terms/standardfilt/[0]==shark", "/terms/standardfilt/[1]==2", @@ -526,6 +518,7 @@ public void testTermsWithJSON() throws Exception { // with terms.list and terms.ttf=true params.set("terms.ttf", "true"); assertJQ( + "/terms", req(params), "/terms/standardfilt/[0]==shark", "/terms/standardfilt/[1]/df==2", @@ -543,11 +536,12 @@ public void testDocFreqAndTotalTermFreq() { SolrQueryRequest req = req( "indent", "true", - "qt", "/terms", "terms.fl", "standardfilt", "terms.ttf", "true", "terms.list", "snake,spider,shark,ddddd"); assertQ( + null, + "/terms", req, "count(//lst[@name='standardfilt']/*)=4", "//lst[@name='standardfilt']/lst[@name='ddddd']/long[@name='df'][.='4']", @@ -563,12 +557,13 @@ public void testDocFreqAndTotalTermFreq() { req = req( "indent", "true", - "qt", "/terms", "terms.fl", "standardfilt", "terms.ttf", "true", "terms.limit", "-1", "terms.sort", "count"); assertQ( + null, + "/terms", req, "count(//lst[@name='standardfilt']/*)>=4", // it would be at-least 4 "//lst[@name='standardfilt']/lst[@name='ddddd']/long[@name='df'][.='4']", @@ -586,11 +581,12 @@ public void testDocFreqAndTotalTermFreqForNonExistingTerm() { SolrQueryRequest req = req( "indent", "true", - "qt", "/terms", "terms.fl", "standardfilt", "terms.ttf", "true", "terms.list", "boo,snake"); assertQ( + null, + "/terms", req, "count(//lst[@name='standardfilt']/*)=1", "//lst[@name='standardfilt']/lst[@name='snake']/long[@name='df'][.='3']", @@ -602,12 +598,13 @@ public void testDocFreqAndTotalTermFreqForMultipleFields() { SolrQueryRequest req = req( "indent", "true", - "qt", "/terms", "terms.fl", "lowerfilt", "terms.fl", "standardfilt", "terms.ttf", "true", "terms.list", "a,aa,aaa"); assertQ( + null, + "/terms", req, "count(//lst[@name='lowerfilt']/*)=3", "count(//lst[@name='standardfilt']/*)=3", @@ -628,13 +625,14 @@ public void testDocFreqAndTotalTermFreqForMultipleFields() { req = req( "indent", "true", - "qt", "/terms", "terms.fl", "lowerfilt", "terms.fl", "standardfilt", "terms.ttf", "true", "terms.sort", "index", "terms.limit", "10"); assertQ( + null, + "/terms", req, "count(//lst[@name='lowerfilt']/*)<=10", "count(//lst[@name='standardfilt']/*)<=10", @@ -689,10 +687,7 @@ public void testPointField() throws Exception { val2 = vals[i]; } - SolrQueryRequest req = - req( - "qt", "/terms", - "terms.fl", "foo_pi"); + SolrQueryRequest req = req("terms.fl", "foo_pi"); ; try { /* SchemaField sf = req.getSchema().getField("foo_pi"); @@ -777,17 +772,9 @@ public void testPointField() throws Exception { assertEquals(i, nvals); assertQ( - req( - "indent", - "true", - "qt", - "/terms", - "terms.fl", - "foo_pi", - "terms.sort", - "index", - "terms.limit", - "2"), + null, + "/terms", + req("indent", "true", "terms.fl", "foo_pi", "terms.sort", "index", "terms.limit", "2"), "count(//lst[@name='foo_pi']/*)=2", "//lst[@name='foo_pi']/int[1][@name='" + val1 + "']", "//lst[@name='foo_pi']/int[2][@name='" + val2 + "']"); @@ -834,7 +821,9 @@ public void testDatePointField() { assertU(commit()); assertQ( - req("indent", "true", "qt", "/terms", "terms.fl", "foo_pdt", "terms.sort", "count"), + null, + "/terms", + req("indent", "true", "terms.fl", "foo_pdt", "terms.sort", "count"), "count(//lst[@name='foo_pdt']/*)=2", "//lst[@name='foo_pdt']/int[1][@name='" + dates[1] + "'][.='51']", "//lst[@name='foo_pdt']/int[2][@name='" + dates[0] + "'][.='50']"); @@ -844,7 +833,9 @@ public void testDatePointField() { assertU(commit()); assertQ( - req("indent", "true", "qt", "/terms", "terms.fl", "foo_pdt", "terms.sort", "count"), + null, + "/terms", + req("indent", "true", "terms.fl", "foo_pdt", "terms.sort", "count"), "count(//lst[@name='foo_pdt']/*)=0"); } } diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestMatchedQueriesComponent.java b/solr/core/src/test/org/apache/solr/handler/component/TestMatchedQueriesComponent.java index a0a4b891742..fa7e7aaf717 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/TestMatchedQueriesComponent.java +++ b/solr/core/src/test/org/apache/solr/handler/component/TestMatchedQueriesComponent.java @@ -47,7 +47,8 @@ public static void beforeClass() throws Exception { @Test public void testNotEnabledByDefault() throws Exception { assertJQ( - req("qt", HANDLER, "q", "{!term name=fantasy_cat f=cat_s}fantasy", "sort", "id asc"), + HANDLER, + req("q", "{!term name=fantasy_cat f=cat_s}fantasy", "sort", "id asc"), "!/matched_queries_per_hit==null", "!/matched_queries_summary==null"); } @@ -56,8 +57,8 @@ public void testNotEnabledByDefault() throws Exception { @Test public void testSingleNamedTermQuery() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!term name=fantasy_cat f=cat_s}fantasy", "matched_queries", "true", "sort", "id asc", @@ -75,8 +76,8 @@ public void testSingleNamedTermQuery() throws Exception { @Test public void testShortParamAlias() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!term name=fantasy_cat f=cat_s}fantasy", "mq", "true", "sort", "id asc", @@ -92,8 +93,8 @@ public void testShortParamAlias() throws Exception { @Test public void testTwoNamedQueriesOr() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "({!term name=fantasy_cat f=cat_s}fantasy) OR ({!term name=scifi_cat f=cat_s}scifi)", "matched_queries", "true", @@ -110,8 +111,8 @@ public void testTwoNamedQueriesOr() throws Exception { @Test public void testUnnamedQueryProducesNoOutput() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!term f=cat_s}fantasy", "matched_queries", "true", "sort", "id asc", @@ -126,8 +127,8 @@ public void testUnnamedQueryProducesNoOutput() throws Exception { public void testMultiValuedFieldBothNamesPresent() throws Exception { // docs 2 and 3 match both fantasy_cat and childrens_cat assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "({!term name=fantasy_cat f=cat_s}fantasy) OR ({!term name=childrens_cat f=cat_s}childrens)", "matched_queries", "true", @@ -146,8 +147,8 @@ public void testMultiValuedFieldBothNamesPresent() throws Exception { @Test public void testTermsNamedQuery() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!terms name=genre_all f=cat_s}fantasy,scifi", "matched_queries", "true", "sort", "id asc", @@ -167,8 +168,8 @@ public void testTermsNamedQuery() throws Exception { @Test public void testBoolOuterAndInnerNamesComposed() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!bool name=all_books" + " should='{!term name=fantasy_cat f=cat_s}fantasy'" @@ -198,8 +199,8 @@ public void testBoolOuterAndInnerNamesComposed() throws Exception { @Test public void testBoolMultipleShouldNamedTerms() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!bool should='{!term name=fantasy_cat f=cat_s}fantasy'" + " should='{!term name=scifi_cat f=cat_s}scifi'}", @@ -225,8 +226,8 @@ public void testBoolMultipleShouldNamedTerms() throws Exception { public void testBoolMustWithNamedShould() throws Exception { // MUST: all 4 fantasy docs; named SHOULD: only docs 2 and 3 (childrens) assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!bool must='{!term f=cat_s}fantasy'" + " should='{!term name=childrens_cat f=cat_s}childrens'}", @@ -251,8 +252,8 @@ public void testBoolMustWithNamedShould() throws Exception { @Test public void testPrefixNamedQuery() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!prefix name=fanta_prefix f=cat_s}fanta", "matched_queries", "true", "sort", "id asc", @@ -269,8 +270,8 @@ public void testPrefixNamedQuery() throws Exception { @Test public void testEdismaxNamedQuery() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!edismax name=fantasy_edismax qf=cat_s}fantasy", "matched_queries", "true", "sort", "id asc", @@ -287,8 +288,8 @@ public void testEdismaxNamedQuery() throws Exception { @Test public void testLuceneNamedQuery() throws Exception { assertJQ( + HANDLER, req( - "qt", HANDLER, "q", "{!lucene name=scifi_lucene df=cat_s}scifi", "matched_queries", "true", "sort", "id asc", diff --git a/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java b/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java index c6175d24dd7..acbd029fd10 100644 --- a/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java +++ b/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java @@ -62,7 +62,7 @@ public void testPostFilterIntrospection() throws Exception { Arrays.asList( params(), // QEC boosting shouldn't impact what impl we get in any situation - params("qt", "/elevate", "elevateIds", "42"))) { + params("elevateIds", "42"))) { try (SolrQueryRequest req = req()) { // non-block based collapse situations, regardless of nullPolicy... @@ -347,12 +347,17 @@ public void testSimple() { // same query, but boosting a diff p1 sku to change group head (and result order) assertQ( + null, + "/elevate", req( - "q", q, - "qt", "/elevate", - "elevateIds", "p1s1", - "fq", "{!collapse " + opt + nullPolicy + "}", - "sort", "score desc, num_i asc"), + "q", + q, + "elevateIds", + "p1s1", + "fq", + "{!collapse " + opt + nullPolicy + "}", + "sort", + "score desc, num_i asc"), "*[count(//doc)=3]", "//result/doc[1]/str[@name='id'][.='p1s1']", "//result/doc[2]/str[@name='id'][.='p2s4']", @@ -360,12 +365,17 @@ public void testSimple() { // same query, but boosting multiple skus from p1 assertQ( + null, + "/elevate", req( - "q", q, - "qt", "/elevate", - "elevateIds", "p1s1,p1s2", - "fq", "{!collapse " + opt + nullPolicy + "}", - "sort", "score desc, num_i asc"), + "q", + q, + "elevateIds", + "p1s1,p1s2", + "fq", + "{!collapse " + opt + nullPolicy + "}", + "sort", + "score desc, num_i asc"), "*[count(//doc)=4]", "//result/doc[1]/str[@name='id'][.='p1s1']", "//result/doc[2]/str[@name='id'][.='p1s2']", @@ -386,9 +396,10 @@ public void testSimple() { "//result/doc[3][str[@name='id'][.='p2s3'] and float[@name='score'][.=141.0]]"); // same query, but boosting a diff child to change group head (and result order) assertQ( + null, + "/elevate", req( "q", "{!func}sum(42, num_i)", - "qt", "/elevate", "elevateIds", "p1s1", "fq", "{!collapse " + opt + nullPolicy + "}", "fl", "score,id", @@ -399,9 +410,10 @@ public void testSimple() { "//result/doc[3][str[@name='id'][.='p2s3'] and float[@name='score'][.=141.0]]"); // same query, but boosting multiple skus from p1 assertQ( + null, + "/elevate", req( "q", "{!func}sum(42, num_i)", - "qt", "/elevate", "elevateIds", "p1s2,p1s1", "fq", "{!collapse " + opt + nullPolicy + "}", "fl", "score,id", @@ -467,9 +479,10 @@ public void testSimple() { "//result/doc[3]/str[@name='id'][.='p2s2']"); // same query, but boosting skus to change group head (and result order) assertQ( + null, + "/elevate", req( "q", "txt_t:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p2s3,p1s1", "fq", "{!collapse " + opt + selector + nullPolicy + "}", "sort", "score desc, num_i asc"), @@ -479,9 +492,10 @@ public void testSimple() { "//result/doc[3]/str[@name='id'][.='p3s4']"); // same query, but boosting multiple skus from p1 assertQ( + null, + "/elevate", req( "q", "txt_t:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p2s3,p1s4,p1s3", "fq", "{!collapse " + opt + selector + nullPolicy + "}", "sort", "score desc, num_i asc"), @@ -525,9 +539,10 @@ public void testSimple() { "//result/doc[3][str[@name='id'][.='p3s3'] and float[@name='score'][.=1276.0]]"); // same query, but boosting multiple skus from p1 assertQ( + null, + "/elevate", req( "q", "{!func}sum(42, num_i)", - "qt", "/elevate", "elevateIds", "p1s2,p1s1", "fq", "{!collapse " + opt + selector + nullPolicy + "}", "fl", "score,id", @@ -565,9 +580,10 @@ public void testSimple() { // NOTE: this causes each boosted doc to be returned, but top level sort is not score, // so QEC doesn't hijack order assertQ( + null, + "/elevate", req( "q", "*:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p3s3,p3s2", "fq", "{!collapse " + opt + selector + nullPolicy + "}", "fl", "id", @@ -581,9 +597,10 @@ public void testSimple() { "//result/doc[4][str[@name='id'][.='p3s3']]"); // same query, w/forceElevation to change top level order assertQ( + null, + "/elevate", req( "q", "*:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p3s3,p3s2", "forceElevation", "true", "fq", "{!collapse " + opt + selector + nullPolicy + "}", @@ -654,9 +671,10 @@ public void testNullPolicyExpand() { "//result/doc[7]/str[@name='id'][.='z100']"); // same query, but boosting docs to change group heads (and result order) assertQ( + null, + "/elevate", req( "q", "*:* txt_t:XX", - "qt", "/elevate", "elevateIds", "z2,p3s3", "fq", "{!collapse " + opt + " nullPolicy=expand}", "sort", "score desc, num_i asc"), @@ -686,9 +704,10 @@ public void testNullPolicyExpand() { "//result/doc[7][str[@name='id'][.='z1'] and float[@name='score'][.=43.0]]"); // same query, but boosting docs to change group heads (and result order) assertQ( + null, + "/elevate", req( "q", "{!func}sum(42, num_i)", - "qt", "/elevate", "elevateIds", "p2s4,z2,p2s1", "fq", "{!collapse " + opt + " nullPolicy=expand}", "fl", "score,id", @@ -758,9 +777,10 @@ public void testNullPolicyExpand() { // NOTE: this causes each boosted doc to be returned, but top level sort is not score, so // QEC doesn't hijack order assertQ( + null, + "/elevate", req( "q", "num_i:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p3s3,z3,p3s1", "fq", "{!collapse " + opt + selector + " nullPolicy=expand}", "sort", "num_i asc"), @@ -775,9 +795,10 @@ public void testNullPolicyExpand() { "//result/doc[8]/str[@name='id'][.='p3s3']"); // same query, w/forceElevation to change top level order assertQ( + null, + "/elevate", req( "q", "num_i:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p3s3,z3,p3s1", "forceElevation", "true", "fq", "{!collapse " + opt + selector + " nullPolicy=expand}", @@ -832,9 +853,10 @@ public void testNullPolicyExpand() { // NOTE: this causes each boosted doc to be returned, but top level sort is not score, so // QEC doesn't hijack order assertQ( + null, + "/elevate", req( "q", "{!func}sum(42, num_i)", - "qt", "/elevate", "elevateIds", "p3s1,z3,p3s4", "fq", "{!collapse " + opt + selector + " nullPolicy=expand}", "fl", "score,id", @@ -850,9 +872,10 @@ public void testNullPolicyExpand() { "//result/doc[8][str[@name='id'][.='p1s3'] and float[@name='score'][.=819.0]]"); // same query, w/forceElevation to change top level order assertQ( + null, + "/elevate", req( "q", "{!func}sum(42, num_i)", - "qt", "/elevate", "elevateIds", "p3s1,z3,p3s4", "forceElevation", "true", "fq", "{!collapse " + opt + selector + " nullPolicy=expand}", @@ -901,9 +924,10 @@ public void testNullPolicyExpand() { // NOTE: this causes each boosted doc to be returned, but top level sort is not score, so // QEC doesn't hijack order assertQ( + null, + "/elevate", req( "q", "*:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p3s3,z3,p3s4", "fq", "{!collapse " + opt + selector + " nullPolicy=expand}", "fl", "id", @@ -920,9 +944,10 @@ public void testNullPolicyExpand() { ); // same query, w/forceElevation to change top level order assertQ( + null, + "/elevate", req( "q", "*:* txt_t:XX", - "qt", "/elevate", "elevateIds", "p3s3,z3,p3s4", "forceElevation", "true", "fq", "{!collapse " + opt + selector + " nullPolicy=expand}", @@ -999,10 +1024,11 @@ public void testBlockCollapseWithExpandComponent() { // score based collapse with boost to change p1 group head assertQ( + null, + "/elevate", req( "q", "txt_t:XX", // only child docs with XX match "expand", "true", - "qt", "/elevate", "elevateIds", "p1s1", "fl", "id", "fq", "{!collapse " + opt + nullPolicy + "}", diff --git a/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java index 5b674fd4cc7..1db1027bff7 100644 --- a/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java +++ b/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java @@ -183,10 +183,11 @@ public void testMultiSort() { params.add("q", "*:*"); params.add("fq", "{!collapse field=group_s sort='term_s desc, test_l asc'}"); params.add("sort", "test_l asc"); - params.add("qt", "/elevate"); params.add("forceElevation", "true"); params.add("elevateIds", "4"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=2]", "//result/doc[1]/str[@name='id'][.='4']", @@ -196,10 +197,11 @@ public void testMultiSort() { params.add("q", "*:*"); params.add("fq", "{!collapse field=group_s sort='term_s desc, test_l asc'}"); params.add("sort", "test_l asc"); - params.add("qt", "/elevate"); params.add("forceElevation", "true"); params.add("elevateIds", "7"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=2]", "//result/doc[1]/str[@name='id'][.='7']", @@ -567,8 +569,9 @@ private void testCollapseQueries(String group, String hint, boolean numeric) { params.add("defType", "edismax"); params.add("bf", "field(test_i)"); params.add("qf", "term_s"); - params.add("qt", "/elevate"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=4]", "//result/doc[1]/str[@name='id'][.='1']", @@ -586,9 +589,10 @@ private void testCollapseQueries(String group, String hint, boolean numeric) { params.add("defType", "edismax"); params.add("bf", "field(test_i)"); params.add("qf", "term_s"); - params.add("qt", "/elevate"); params.add("elevateIds", "1,5"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=3]", "//result/doc[1]/str[@name='id'][.='1']", @@ -605,9 +609,10 @@ private void testCollapseQueries(String group, String hint, boolean numeric) { params.add("defType", "edismax"); params.add("bf", "field(test_i)"); params.add("qf", "term_s"); - params.add("qt", "/elevate"); params.add("elevateIds", "1,5"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=3]", "//result/doc[1]/str[@name='id'][.='1']", @@ -624,9 +629,10 @@ private void testCollapseQueries(String group, String hint, boolean numeric) { params.add("defType", "edismax"); params.add("bf", "field(test_i)"); params.add("qf", "term_s"); - params.add("qt", "/elevate"); params.add("elevateIds", "1,5"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=3]", "//result/doc[1]/str[@name='id'][.='1']", @@ -641,9 +647,10 @@ private void testCollapseQueries(String group, String hint, boolean numeric) { params.add("defType", "edismax"); params.add("bf", "field(test_i)"); params.add("qf", "term_s"); - params.add("qt", "/elevate"); params.add("elevateIds", "3,4"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=4]", "//result/doc[1]/str[@name='id'][.='3']", @@ -975,8 +982,9 @@ private void testCollapseQueries(String group, String hint, boolean numeric) { params.add("defType", "edismax"); params.add("bf", "field(test_i)"); params.add("qf", "term_s"); - params.add("qt", "/elevate"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=3]", "//result/doc[1]/str[@name='id'][.='3']", @@ -1380,10 +1388,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[3]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "1,5", "q", @@ -1397,10 +1405,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[4]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "0,7", "q", @@ -1415,10 +1423,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[5]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "6,0", "q", @@ -1447,10 +1455,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[4]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "1,5", "q", @@ -1465,10 +1473,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[5]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "0,7", "q", @@ -1483,10 +1491,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[5]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "6,0", "q", @@ -1517,10 +1525,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[6]/str[@name='id'][.='0']" // null ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "1,5", "q", @@ -1537,10 +1545,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[7]/str[@name='id'][.='0']" // null ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "0,7", "q", @@ -1556,10 +1564,10 @@ public void testNullGroupNumericVsStringCollapse() { "//result/doc[6]/str[@name='id'][.='3']" // group B ); assertQ( + null, + "/elevate", req( params( - "qt", - "/elevate", "elevateIds", "6,0", "q", diff --git a/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java index f3149af82bc..389447d20e4 100644 --- a/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java +++ b/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java @@ -491,9 +491,10 @@ public void testReRankQueries() { params.add("fl", "id,score"); params.add("start", "0"); params.add("rows", "10"); - params.add("qt", "/elevate"); params.add("elevateIds", "1"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=6]", "//result/doc[1]/str[@name='id'][.='1']", @@ -553,10 +554,11 @@ public void testReRankQueries() { params.add("fl", "id,score"); params.add("start", "0"); params.add("rows", "10"); - params.add("qt", "/elevate"); params.add("elevateIds", "1,4"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=6]", "//result/doc[1]/str[@name='id'][.='1']", // Elevated @@ -585,10 +587,11 @@ public void testReRankQueries() { params.add("fl", "id,score"); params.add("start", "0"); params.add("rows", "10"); - params.add("qt", "/elevate"); params.add("elevateIds", "4,1"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=6]", "//result/doc[1]/str[@name='id'][.='4']", // Elevated @@ -616,10 +619,11 @@ public void testReRankQueries() { params.add("fl", "id,score"); params.add("start", "0"); params.add("rows", "10"); - params.add("qt", "/elevate"); params.add("elevateIds", "4,1"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=6]", "//result/doc[1]/str[@name='id'][.='4']", // Elevated @@ -649,10 +653,11 @@ public void testReRankQueries() { params.add("fl", "id,score"); params.add("start", "4"); params.add("rows", "10"); - params.add("qt", "/elevate"); params.add("elevateIds", "4,1"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=2]", "//result/doc[1]/str[@name='id'][.='3']", @@ -678,10 +683,9 @@ public void testReRankQueries() { params.add("fl", "id,score"); params.add("start", "4"); params.add("rows", "10"); - params.add("qt", "/elevate"); params.add("elevateIds", "4,1"); - assertQ(req(params), "*[count(//doc)=0]"); + assertQ(null, "/elevate", req(params), "*[count(//doc)=0]"); // Pass in reRankDocs lower than the length being collected. params = new ModifiableSolrParams(); @@ -1095,10 +1099,11 @@ public void testOverRank() { params.add("fl", "id,score"); params.add("start", "0"); params.add("rows", "3"); - params.add("qt", "/elevate"); params.add("elevateIds", "1,4"); assertQ( + null, + "/elevate", req(params), "*[count(//doc)=3]", "//result/doc[1]/str[@name='id'][.='1']", // Elevated diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index 9665aac95b6..323e392c0fc 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -900,6 +900,11 @@ public static void assertQ( /** Makes a query request and returns the JSON string response */ public static String JQ(SolrQueryRequest req) throws Exception { + return JQ(req.getParams().get(CommonParams.QT), req); + } + + /** Makes a query request against the named handler and returns the JSON string response */ + public static String JQ(String handler, SolrQueryRequest req) throws Exception { SolrParams params = req.getParams(); if (!"json".equals(params.get("wt", "xml")) || params.get("indent") == null) { ModifiableSolrParams newParams = new ModifiableSolrParams(params); @@ -911,7 +916,7 @@ public static String JQ(SolrQueryRequest req) throws Exception { String response; boolean failed = true; try { - response = h.query(req); + response = h.query(handler, req); failed = false; } finally { if (failed) { @@ -948,6 +953,19 @@ public static String assertJQ(SolrQueryRequest req, String... tests) throws Exce return assertJQ(req, JSONTestUtil.DEFAULT_DELTA, tests); } + /** + * Validates a query against the named handler matches some JSON test expressions using the + * default double delta tolerance. + * + * @see JSONTestUtil#DEFAULT_DELTA + * @see #assertJQ(String,SolrQueryRequest,double,String...) + * @return The request response as a JSON String if all test patterns pass + */ + public static String assertJQ(String handler, SolrQueryRequest req, String... tests) + throws Exception { + return assertJQ(handler, req, JSONTestUtil.DEFAULT_DELTA, tests); + } + /** * Validates a query matches some JSON test expressions and closes the query. The text expression * is of the form path:JSON. The Noggit JSON parser used accepts single quoted strings and bare @@ -963,6 +981,21 @@ public static String assertJQ(SolrQueryRequest req, String... tests) throws Exce */ public static String assertJQ(SolrQueryRequest req, double delta, String... tests) throws Exception { + return assertJQ(req.getParams().get(CommonParams.QT), req, delta, tests); + } + + /** + * Validates a query against the named handler matches some JSON test expressions and closes the + * query. + * + * @param handler the name of the request handler to process the request + * @param req Solr request to execute + * @param delta tolerance allowed in comparing float/double values + * @param tests JSON path expression + '==' + expected value + * @return The request response as a JSON String if all test patterns pass + */ + public static String assertJQ(String handler, SolrQueryRequest req, double delta, String... tests) + throws Exception { SolrParams params = null; try { params = req.getParams(); @@ -976,7 +1009,7 @@ public static String assertJQ(SolrQueryRequest req, double delta, String... test String response; boolean failed = true; try { - response = h.query(req); + response = h.query(handler, req); failed = false; } finally { if (failed) { @@ -1021,6 +1054,11 @@ public static String assertThatJQ(SolrQueryRequest req, Matcher test) thr return assertThatJQ(req, "", test); } + public static String assertThatJQ(String handler, SolrQueryRequest req, Matcher test) + throws Exception { + return assertThatJQ(handler, req, "", test); + } + /** * Validates a query completes and, using JSON deserialization, returns an object that passes the * given Matcher test. @@ -1033,9 +1071,24 @@ public static String assertThatJQ(SolrQueryRequest req, Matcher test) thr * @param test Matcher for the given object returned from deserializing the response * @return The request response as a JSON String if the test matcher passes */ - @SuppressWarnings("unchecked") public static String assertThatJQ(SolrQueryRequest req, String message, Matcher test) throws Exception { + return assertThatJQ(req.getParams().get(CommonParams.QT), req, message, test); + } + + /** + * Validates a query against the named handler completes and, using JSON deserialization, returns + * an object that passes the given Matcher test. + * + * @param handler the name of the request handler to process the request + * @param req Solr request to execute + * @param message Failure message for test + * @param test Matcher for the given object returned from deserializing the response + * @return The request response as a JSON String if the test matcher passes + */ + @SuppressWarnings("unchecked") + public static String assertThatJQ( + String handler, SolrQueryRequest req, String message, Matcher test) throws Exception { final SolrParams params = req.getParams(); try { if (!"json".equals(params.get("wt", "xml")) || params.get("indent") == null) { @@ -1048,7 +1101,7 @@ public static String assertThatJQ(SolrQueryRequest req, String message, Matc String response; boolean failed = true; try { - response = h.query(req); + response = h.query(handler, req); failed = false; } finally { if (failed) { @@ -1076,9 +1129,14 @@ public static String assertThatJQ(SolrQueryRequest req, String message, Matc /** Makes sure a query throws a SolrException with the listed response code */ public static void assertQEx(String message, SolrQueryRequest req, int code) { + assertQEx(message, req, code, req.getParams().get(CommonParams.QT)); + } + + /** Makes sure a query against the named handler throws a SolrException with the given code */ + public static void assertQEx(String message, SolrQueryRequest req, int code, String handler) { try { ignoreException("."); - h.query(req); + h.query(handler, req); fail(message); } catch (SolrException sex) { assertEquals(code, sex.code()); @@ -1090,9 +1148,15 @@ public static void assertQEx(String message, SolrQueryRequest req, int code) { } public static void assertQEx(String message, SolrQueryRequest req, SolrException.ErrorCode code) { + assertQEx(message, req, code, req.getParams().get(CommonParams.QT)); + } + + /** Makes sure a query against the named handler throws a SolrException with the given code */ + public static void assertQEx( + String message, SolrQueryRequest req, SolrException.ErrorCode code, String handler) { try { ignoreException("."); - h.query(req); + h.query(handler, req); fail(message); } catch (SolrException e) { assertEquals(code.code, e.code()); @@ -1117,9 +1181,29 @@ public static void assertQEx( String exceptionMessage, SolrQueryRequest req, SolrException.ErrorCode code) { + assertQEx(failMessage, exceptionMessage, req, code, req.getParams().get(CommonParams.QT)); + } + + /** + * Makes sure a query against the named handler throws a SolrException with the listed response + * code and expected message + * + * @param failMessage The assert message to show when the query doesn't throw the expected + * exception + * @param exceptionMessage A substring of the message expected in the exception + * @param req Solr request + * @param code expected error code for the query + * @param handler the name of the request handler to process the request + */ + public static void assertQEx( + String failMessage, + String exceptionMessage, + SolrQueryRequest req, + SolrException.ErrorCode code, + String handler) { try { ignoreException("."); - h.query(req); + h.query(handler, req); fail(failMessage); } catch (SolrException e) { assertEquals(code.code, e.code());