diff --git a/solr/core/src/test/org/apache/solr/DisMaxRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/DisMaxRequestHandlerTest.java index e82df1e4bfbc..059921fa406a 100644 --- a/solr/core/src/test/org/apache/solr/DisMaxRequestHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/DisMaxRequestHandlerTest.java @@ -127,7 +127,7 @@ public void doTestSomeStuff(final String qt) { assertQ( "multi qf", - req("q", "cool", "qt", qt, "qf", "subject", "qf", "features_t"), + reqWithPath(qt, "q", "cool", "qf", "subject", "qf", "features_t"), "//*[@numFound='3']"); assertQ( @@ -137,7 +137,7 @@ public void doTestSomeStuff(final String qt) { assertQ( "boost query", - req("q", "cool stuff", "qt", qt, "bq", "subject:hell^400"), + reqWithPath(qt, "q", "cool stuff", "bq", "subject:hell^400"), "//*[@numFound='3']", "//result/doc[1]/str[@name='id'][.='666']", "//result/doc[2]/str[@name='id'][.='42']", @@ -145,11 +145,10 @@ public void doTestSomeStuff(final String qt) { assertQ( "multi boost query", - req( + reqWithPath( + qt, "q", "cool stuff", - "qt", - qt, "bq", "subject:hell^400", "bq", @@ -172,29 +171,19 @@ public void doTestSomeStuff(final String qt) { assertQ( "relying on ALTQ from config", - req( - "qt", qt, - "fq", "id:666", - "facet", "false"), + reqWithPath(qt, "fq", "id:666", "facet", "false"), "//*[@numFound='1']"); assertQ( "explicit ALTQ", - req( - "qt", qt, - "q.alt", "id:9999", - "fq", "id:666", - "facet", "false"), + reqWithPath(qt, "q.alt", "id:9999", "fq", "id:666", "facet", "false"), "//*[@numFound='0']"); assertQ( - "no query slop == no match", req("qt", qt, "q", "\"cool chick\""), "//*[@numFound='0']"); + "no query slop == no match", reqWithPath(qt, "q", "\"cool chick\""), "//*[@numFound='0']"); assertQ( "query slop == match", - req( - "qt", qt, - "qs", "2", - "q", "\"cool chick\""), + reqWithPath(qt, "qs", "2", "q", "\"cool chick\""), "//*[@numFound='1']"); } @@ -228,11 +217,10 @@ public void testExtraBlankBQ() throws Exception { Pattern p_bool = Pattern.compile("\\(subject:hell\\s*subject:cool\\)"); String resp = h.query( - req( + reqWithPath( + "/dismax", "q", "cool stuff", - "qt", - "/dismax", "bq", "subject:hell OR subject:cool", CommonParams.DEBUG_QUERY, @@ -242,11 +230,10 @@ public void testExtraBlankBQ() throws Exception { resp = h.query( - req( + reqWithPath( + "/dismax", "q", "cool stuff", - "qt", - "/dismax", "bq", "subject:hell OR subject:cool", "bq", diff --git a/solr/core/src/test/org/apache/solr/MinimalSchemaTest.java b/solr/core/src/test/org/apache/solr/MinimalSchemaTest.java index 2241f4d58b7b..837aa2e4cca4 100644 --- a/solr/core/src/test/org/apache/solr/MinimalSchemaTest.java +++ b/solr/core/src/test/org/apache/solr/MinimalSchemaTest.java @@ -71,13 +71,12 @@ public void testSimpleQueries() { @Test public void testLuke() { - assertQ("basic luke request failed", req("qt", "/admin/luke"), "//int[@name='numDocs'][.='2']"); + assertQ( + "basic luke request failed", reqWithPath("/admin/luke"), "//int[@name='numDocs'][.='2']"); assertQ( "luke show schema failed", - req( - "qt", "/admin/luke", - "show", "schema"), + reqWithPath("/admin/luke", "show", "schema"), "//int[@name='numDocs'][.='2']", "//null[@name='uniqueKeyField']"); } @@ -111,11 +110,12 @@ public void testAllConfiguredHandlers() { assertQ( "failure w/handler: '" + handler + "'", - req( - "qt", handler, - // this should be fairly innocuous for any type of query - "q", "foo:bar", - "omitHeader", "false"), + reqWithPath( + handler, // this should be fairly innocuous for any type of query + "q", + "foo:bar", + "omitHeader", + "false"), "//lst[@name='responseHeader']"); } catch (Exception e) { throw new RuntimeException("exception w/handler: '" + handler + "'", e); diff --git a/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java b/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java index 53603a1f9314..efd1ebc03204 100644 --- a/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java +++ b/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java @@ -33,7 +33,7 @@ public static void beforeClass() throws Exception { } public void testAltDirectoryUsed() { - assertQ(req("q", "*:*", "qt", "/select")); + assertQ(reqWithPath("/select", "q", "*:*")); assertTrue(TestFSDirectoryFactory.openCalled); assertTrue(TestIndexReaderFactory.newReaderCalled); } diff --git a/solr/core/src/test/org/apache/solr/core/RequestHandlersTest.java b/solr/core/src/test/org/apache/solr/core/RequestHandlersTest.java index c332f264486a..5962b3b7ac97 100644 --- a/solr/core/src/test/org/apache/solr/core/RequestHandlersTest.java +++ b/solr/core/src/test/org/apache/solr/core/RequestHandlersTest.java @@ -88,12 +88,12 @@ public void testLazyLoading() { // But it should behave just like the 'defaults' request handler above assertQ( "lazy handler returns fewer matches", - req("q", "id:[42 TO 47]", "qt", "/lazy"), + reqWithPath("/lazy", "q", "id:[42 TO 47]"), "*[count(//doc)=4]"); assertQ( "lazy handler includes highlighting", - req("q", "name:Zapp OR title:General", "qt", "/lazy"), + reqWithPath("/lazy", "q", "name:Zapp OR title:General"), "//lst[@name='highlighting']"); } diff --git a/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java index 5fa90f325a8c..1d4b56fe2bcd 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java @@ -112,13 +112,13 @@ private void assertHistoBucket(int slot, int in) { public void testLuke() { // test that Luke can handle all the field types - assertQ(req("qt", "/admin/luke", "id", "SOLR1000")); + assertQ(reqWithPath("/admin/luke", "id", "SOLR1000")); final int numFlags = EnumSet.allOf(FieldFlag.class).size(); assertQ( "Not all flags (" + numFlags + ") mentioned in info->key", - req("qt", "/admin/luke"), + reqWithPath("/admin/luke"), numFlags + "=count(//lst[@name='info']/lst[@name='key']/str)"); // code should be the same for all fields, but just in case do several @@ -129,7 +129,7 @@ public void testLuke() { final String xp = getFieldXPathPrefix(f); assertQ( "Not as many schema flags as expected (" + numFlags + ") for " + f, - req("qt", "/admin/luke", "fl", f), + reqWithPath("/admin/luke", "fl", f), numFlags + "=string-length(" + xp + "[@name='schema'])"); } @@ -140,13 +140,13 @@ public void testLuke() { final String xp = getFieldXPathPrefix(f); assertQ( "Not as many index flags as expected (" + numFlags + ") for " + f, - req("qt", "/admin/luke", "fl", f), + reqWithPath("/admin/luke", "fl", f), numFlags + "=string-length(" + xp + "[@name='index'])"); final String hxp = getFieldXPathHistogram(f); assertQ( "Historgram field should be present for field " + f, - req("qt", "/admin/luke", "fl", f), + reqWithPath("/admin/luke", "fl", f), hxp + "[@name='histogram']"); } } @@ -169,7 +169,7 @@ private static String dynfield(String field) { @Test public void testFlParam() { - SolrQueryRequest req = req("qt", "/admin/luke", "fl", "solr_t solr_s", "show", "all"); + SolrQueryRequest req = reqWithPath("/admin/luke", "fl", "solr_t solr_s", "show", "all"); try { // First, determine that the two fields ARE there String response = h.query(req); @@ -186,7 +186,7 @@ public void testFlParam() { TestHarness.validateXPath(response, getFieldXPathPrefix(f) + "[@name='index']")); } // Insure * works - req = req("qt", "/admin/luke", "fl", "*"); + req = reqWithPath("/admin/luke", "fl", "*"); response = h.query(req); for (String f : Arrays.asList("solr_t", "solr_s", "solr_ti", "solr_td", "solr_dt", "solr_b")) { @@ -202,25 +202,25 @@ public void testNumTerms() { final String f = "name"; for (String n : new String[] {"2", "3", "100", "99999"}) { assertQ( - req("qt", "/admin/luke", "fl", f, "numTerms", n), + reqWithPath("/admin/luke", "fl", f, "numTerms", n), field(f) + "lst[@name='topTerms']/int[@name='Apache']", field(f) + "lst[@name='topTerms']/int[@name='Solr']", "count(" + field(f) + "lst[@name='topTerms']/int)=2"); } assertQ( - req("qt", "/admin/luke", "fl", f, "numTerms", "1"), + reqWithPath("/admin/luke", "fl", f, "numTerms", "1"), // no guarantee which one we find "count(" + field(f) + "lst[@name='topTerms']/int)=1"); assertQ( - req("qt", "/admin/luke", "fl", f, "numTerms", "0"), + reqWithPath("/admin/luke", "fl", f, "numTerms", "0"), "count(" + field(f) + "lst[@name='topTerms']/int)=0"); // field with no terms shouldn't error for (String n : new String[] {"0", "1", "2", "100", "99999"}) { assertQ( - req("qt", "/admin/luke", "fl", "bogus_s", "numTerms", n), + reqWithPath("/admin/luke", "fl", "bogus_s", "numTerms", n), "count(" + field(f) + "lst[@name='topTerms']/int)=0"); } } @@ -234,7 +234,7 @@ public void testNullFactories() throws Exception { try { assertQ( - req("qt", "/admin/luke", "show", "schema"), + reqWithPath("/admin/luke", "show", "schema"), "//lst[@name='custom_tc_string']/lst[@name='indexAnalyzer']", "//lst[@name='custom_tc_string']/lst[@name='queryAnalyzer']", "0=count(//lst[@name='custom_tc_string']/lst[@name='indexAnalyzer']/lst[@name='filters'])", @@ -249,7 +249,7 @@ public void testNullFactories() throws Exception { } public void testCopyFieldLists() throws Exception { - SolrQueryRequest req = req("qt", "/admin/luke", "show", "schema"); + SolrQueryRequest req = reqWithPath("/admin/luke", "show", "schema"); String xml = h.query(req); String r = @@ -284,7 +284,7 @@ public void testCatchAllCopyField() throws Exception { " is missing from the schema", foundCatchAllCopyField); - SolrQueryRequest req = req("qt", "/admin/luke", "show", "schema", "indent", "on"); + SolrQueryRequest req = reqWithPath("/admin/luke", "show", "schema", "indent", "on"); String xml = h.query(req); String result = TestHarness.validateXPath( @@ -323,7 +323,7 @@ public void testIndexFlagsWithDeletedDocs() throws Exception { assertQ( "index flags should be present for solr_s despite deletion in segment", - req("qt", "/admin/luke", "fl", "solr_s"), + reqWithPath("/admin/luke", "fl", "solr_s"), getFieldXPathPrefix("solr_s") + "[@name='index']"); // Now test the inverse: delete the edges and keep the middle. The first term @@ -342,7 +342,7 @@ public void testIndexFlagsWithDeletedDocs() throws Exception { assertQ( "index flags should be present for solr_s when edges are deleted", - req("qt", "/admin/luke", "fl", "solr_s"), + reqWithPath("/admin/luke", "fl", "solr_s"), getFieldXPathPrefix("solr_s") + "[@name='index']"); } finally { deleteCore(); diff --git a/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java index 260953b7bc9f..0098bb94e65b 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/SegmentsInfoRequestHandlerTest.java @@ -97,7 +97,7 @@ public static void afterClass() throws Exception { public void testSegmentInfos() { assertQ( "Unexpected number of segments returned", - req("qt", "/admin/segments"), + reqWithPath("/admin/segments"), NUM_SEGMENTS + "=count(//lst[@name='segments']/lst)"); } @@ -105,7 +105,7 @@ public void testSegmentInfos() { public void testSegmentInfosVersion() { assertQ( "Unexpected number of segments returned", - req("qt", "/admin/segments"), + reqWithPath("/admin/segments"), NUM_SEGMENTS + "=count(//lst[@name='segments']/lst/str[@name='version'][.='" + Version.LATEST @@ -129,14 +129,15 @@ public void testSegmentNames() throws IOException { return null; }); - assertQ("Unexpected segment names returned", req("qt", "/admin/segments"), segmentNamePatterns); + assertQ( + "Unexpected segment names returned", reqWithPath("/admin/segments"), segmentNamePatterns); } @Test public void testSegmentInfosData() { assertQ( "Unexpected document counts in result", - req("qt", "/admin/segments"), + reqWithPath("/admin/segments"), // #Document (DOC_COUNT * 2) + "=sum(//lst[@name='segments']/lst/int[@name='size'])", // #Deletes @@ -147,7 +148,7 @@ public void testSegmentInfosData() { public void testCoreInfo() { assertQ( "Missing core info", - req("qt", "/admin/segments", "coreInfo", "true"), + reqWithPath("/admin/segments", "coreInfo", "true"), "boolean(//lst[@name='info']/lst[@name='core'])"); } @@ -193,7 +194,7 @@ public void testFieldInfo() throws Exception { }); assertQ( "Unexpected field infos returned", - req("qt", "/admin/segments", "fieldInfo", "true"), + reqWithPath("/admin/segments", "fieldInfo", "true"), segmentNamePatterns); } } diff --git a/solr/core/src/test/org/apache/solr/handler/component/InfixSuggestersTest.java b/solr/core/src/test/org/apache/solr/handler/component/InfixSuggestersTest.java index db6069212311..236504ba4471 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/InfixSuggestersTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/InfixSuggestersTest.java @@ -45,7 +45,7 @@ public static void beforeClass() throws Exception { public void test2xBuildReload() throws Exception { for (int i = 0; i < 2; ++i) { assertQ( - req("qt", rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); h.reload(); } @@ -54,12 +54,12 @@ public void test2xBuildReload() throws Exception { @Test public void testTwoSuggestersBuildThenReload() throws Exception { assertQ( - req("qt", rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); h.reload(); assertQ( - req("qt", rh_blended_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh_blended_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); h.reload(); } @@ -67,7 +67,7 @@ public void testTwoSuggestersBuildThenReload() throws Exception { @Test public void testBuildThen2xReload() throws Exception { assertQ( - req("qt", rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); h.reload(); h.reload(); @@ -76,7 +76,7 @@ public void testBuildThen2xReload() throws Exception { @Test public void testAnalyzingInfixSuggesterBuildThenReload() throws Exception { assertQ( - req("qt", rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh_analyzing_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); h.reload(); } @@ -84,7 +84,7 @@ public void testAnalyzingInfixSuggesterBuildThenReload() throws Exception { @Test public void testBlendedInfixSuggesterBuildThenReload() throws Exception { assertQ( - req("qt", rh_blended_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh_blended_short, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); h.reload(); } @@ -102,11 +102,8 @@ public void testReloadDuringBuild() throws Exception { SolrCoreState.CoreIsClosedException.class, () -> assertQ( - req( - "qt", - rh_analyzing_long, - SuggesterParams.SUGGEST_BUILD_ALL, - "true"), + reqWithPath( + rh_analyzing_long, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"))); h.reload(); // Stop the dictionary's input iterator @@ -142,11 +139,8 @@ public void testShutdownDuringBuild() throws Exception { expected, () -> assertQ( - req( - "qt", - rh_analyzing_long, - SuggesterParams.SUGGEST_BUILD_ALL, - "true"), + reqWithPath( + rh_analyzing_long, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"))); Thread.sleep(100); // TODO: is there a better way to ensure that the build has begun? h.close(); diff --git a/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java index 6943af05e1c3..262034f5dd2e 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java @@ -651,9 +651,7 @@ public void testExpectedUserErrors() { assertQEx( "no query param should error", "requires a query string", - req( - "qt", "/phrases", - "phrases.fields", "multigrams_title"), + reqWithPath("/phrases", "phrases.fields", "multigrams_title"), ErrorCode.BAD_REQUEST); } @@ -696,7 +694,7 @@ public void testSimplePhraseRequest() { for (String p : Arrays.asList("q", "phrases.q")) { // basic request... assertQ( - req("qt", HANDLER, p, input), // expect no search results... + reqWithPath(HANDLER, p, input), // expect no search results... "count(//result)=0", // just phrase info... "//lst[@name='phrases']/str[@name='input'][.='" + input + "']", "//lst[@name='phrases']/str[@name='summary'][.='" + expected + "']", @@ -712,7 +710,7 @@ public void testSimplePhraseRequest() { // empty input, empty phrases (and no error)... assertQ( - req("qt", HANDLER, p, ""), // expect no search results... + reqWithPath(HANDLER, p, ""), // expect no search results... "count(//result)=0", // just empty phrase info for our empty input... "//lst[@name='phrases']/str[@name='input'][.='']", "//lst[@name='phrases']/str[@name='summary'][.='']", diff --git a/solr/core/src/test/org/apache/solr/handler/component/ResponseLogComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/ResponseLogComponentTest.java index 569bed2b4635..59911357db5d 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/ResponseLogComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/ResponseLogComponentTest.java @@ -40,11 +40,10 @@ public void testToLogIds() throws Exception { try { String handler = "/withlog"; req = - req( + reqWithPath( + "/withlog", "indent", "true", - "qt", - "/withlog", "q", "aa", "rows", @@ -69,11 +68,10 @@ public void testToLogScores() throws Exception { try { String handler = "/withlog"; req = - req( + reqWithPath( + "/withlog", "indent", "true", - "qt", - "/withlog", "q", "aa", "rows", @@ -98,11 +96,10 @@ public void testDisabling() throws Exception { try { String handler = "/withlog"; req = - req( + reqWithPath( + "/withlog", "indent", "true", - "qt", - "/withlog", "q", "aa", "rows", diff --git a/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java index 3e4eb5e50954..660a059e380f 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java @@ -78,8 +78,7 @@ public void tearDown() throws Exception { @Test public void testMaximumResultsForSuggest() throws Exception { assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -100,8 +99,7 @@ public void testMaximumResultsForSuggest() throws Exception { Exception.class, () -> { assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -119,8 +117,7 @@ public void testMaximumResultsForSuggest() throws Exception { }); assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -145,8 +142,7 @@ public void testMaximumResultsForSuggest() throws Exception { Exception.class, () -> { assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -168,8 +164,7 @@ public void testMaximumResultsForSuggest() throws Exception { }); assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -194,8 +189,7 @@ public void testMaximumResultsForSuggest() throws Exception { Exception.class, () -> { assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -220,8 +214,7 @@ public void testMaximumResultsForSuggest() throws Exception { @Test public void testExtendedResultsCount() throws Exception { assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -237,8 +230,7 @@ public void testExtendedResultsCount() throws Exception { "/spellcheck/suggestions/[1]/numFound==5"); assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -254,25 +246,24 @@ public void testExtendedResultsCount() throws Exception { @Test public void test() throws Exception { assertJQ( - req("qt", rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", "documemt"), + reqWithPath(rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", "documemt"), "/spellcheck=={'suggestions':['documemt',{'numFound':1,'startOffset':0,'endOffset':8,'suggestion':['document']}]}"); } @Test public void testNumericQuery() throws Exception { assertJQ( - req("qt", rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", "12346"), + reqWithPath(rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", "12346"), "/spellcheck=={'suggestions':['12346',{'numFound':1,'startOffset':0,'endOffset':5,'suggestion':['12345']}]}"); } @Test public void testPerDictionary() throws Exception { assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_BUILD, @@ -294,11 +285,10 @@ public void testInvalidDictionary() { assertQEx( "Invalid specified dictionary should throw exception", "Specified dictionaries do not exist: INVALID", - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", @@ -310,11 +300,10 @@ public void testInvalidDictionary() { assertQEx( "Invalid specified dictionary should throw exception", "Specified dictionaries do not exist: INVALID2", - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", @@ -329,11 +318,10 @@ public void testInvalidDictionary() { @Test public void testCollate() throws Exception { assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_BUILD, @@ -344,11 +332,10 @@ public void testCollate() throws Exception { "true"), "/spellcheck/collations/collation=='document'"); assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", @@ -357,11 +344,10 @@ public void testCollate() throws Exception { "true"), "/spellcheck/collations/collation=='document lowerfilt:brown^4'"); assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", @@ -370,11 +356,10 @@ public void testCollate() throws Exception { "true"), "/spellcheck/collations/collation=='document brown'"); assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", @@ -415,8 +400,7 @@ public void testCollateExtendedResultsWithJsonNl() throws Exception { private void implTestCollateExtendedResultsWithJsonNl( String q, String jsonNl, boolean collateExtendedResults, String... tests) throws Exception { final SolrQueryRequest solrQueryRequest = - req( - CommonParams.QT, + reqWithPath( rh, CommonParams.Q, q, @@ -435,11 +419,10 @@ private void implTestCollateExtendedResultsWithJsonNl( public void testCorrectSpelling() throws Exception { // Make sure correct spellings are signaled in the response assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "q", @@ -448,11 +431,10 @@ public void testCorrectSpelling() throws Exception { "true"), "/spellcheck/correctlySpelled==true"); assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "spellcheck.dictionary", @@ -463,11 +445,10 @@ public void testCorrectSpelling() throws Exception { "true"), "/spellcheck/correctlySpelled==true"); assertJQ( - req( + reqWithPath( + rh, "json.nl", "map", - "qt", - rh, SpellCheckComponent.COMPONENT_NAME, "true", "spellcheck.dictionary", @@ -497,8 +478,7 @@ public void testReloadOnStart() throws Exception { assertU(adoc("id", "0", "lowerfilt", "This is a title")); assertU(commit()); SolrQueryRequest request = - req( - "qt", + reqWithPath( "/spellCheckCompRH", "q", "*:*", @@ -526,8 +506,6 @@ public void testReloadOnStart() throws Exception { request = req( - "qt", - "/spellCheckCompRH", "q", "*:*", "spellcheck.q", @@ -558,8 +536,8 @@ public void testReloadOnStart() throws Exception { @Test public void testRebuildOnCommit() throws Exception { SolrQueryRequest req = - req("q", "lowerfilt:lucenejavt", "qt", "/spellCheckCompRH", "spellcheck", "true"); - String response = h.query(req); + reqWithPath("/spellCheckCompRH", "q", "lowerfilt:lucenejavt", "spellcheck", "true"); + String response = h.query("/spellCheckCompRH", req); assertFalse("No suggestions should be returned", response.contains("lucenejava")); assertU(adoc("id", "11231", "lowerfilt", "lucenejava")); @@ -576,8 +554,7 @@ public void testThresholdTokenFrequency() throws Exception { // while "document" is present. assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", @@ -592,8 +569,7 @@ public void testThresholdTokenFrequency() throws Exception { "/spellcheck/suggestions/[1]/suggestion==[{'word':'document','freq':2}]"); assertJQ( - req( - "qt", + reqWithPath( rh, SpellCheckComponent.COMPONENT_NAME, "true", diff --git a/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java b/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java index 3d02dc6c3957..64509d9d3cbd 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java @@ -108,8 +108,7 @@ public void setUp() throws Exception { @Test public void testContextFilterParamIsIgnoredWhenContextIsNotImplemented() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -128,8 +127,7 @@ public void testContextFilterParamIsIgnoredWhenContextIsNotImplemented() { @Test public void testContextFilteringIsIgnoredWhenContextIsImplementedButNotConfigured() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -150,9 +148,8 @@ public void testBuildThrowsIllegalArgumentExceptionWhenContextIsConfiguredButNot IllegalArgumentException.class, () -> { h.query( + rh, req( - "qt", - rh, SuggesterParams.SUGGEST_BUILD, "true", SuggesterParams.SUGGEST_DICT, @@ -164,8 +161,7 @@ public void testBuildThrowsIllegalArgumentExceptionWhenContextIsConfiguredButNot // When not building, no exception is thrown assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "false", @@ -179,15 +175,15 @@ public void testBuildThrowsIllegalArgumentExceptionWhenContextIsConfiguredButNot @Test public void testContextFilterIsTrimmed() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", SuggesterParams.SUGGEST_DICT, "suggest_blended_infix_suggester", SuggesterParams.SUGGEST_CONTEXT_FILTER_QUERY, - " ", // trimmed to null... just as if there was no context filter param + " ", + // trimmed to null... just as if there was no context filter param SuggesterParams.SUGGEST_Q, "examp"), "//lst[@name='suggest']/lst[@name='suggest_blended_infix_suggester']/lst[@name='examp']/int[@name='numFound'][.='3']"); @@ -195,8 +191,7 @@ public void testContextFilterIsTrimmed() { public void testExplicitFieldedQuery() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -213,8 +208,7 @@ public void testExplicitFieldedQuery() { public void testContextFilterOK() { // No filtering assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -229,8 +223,7 @@ public void testContextFilterOK() { // TermQuery assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -245,8 +238,7 @@ public void testContextFilterOK() { // OR BooleanQuery assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -262,8 +254,7 @@ public void testContextFilterOK() { // AND BooleanQuery assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -278,8 +269,7 @@ public void testContextFilterOK() { // PrefixQuery assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -294,8 +284,7 @@ public void testContextFilterOK() { // RangeQuery assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -311,8 +300,7 @@ public void testContextFilterOK() { // WildcardQuery assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -330,8 +318,7 @@ public void testContextFilterOK() { public void testStringContext() { // Here, the context field is a string, so it's case-sensitive assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -344,8 +331,7 @@ public void testStringContext() { "//lst[@name='suggest']/lst[@name='suggest_blended_infix_suggester_string']/lst[@name='examp']/int[@name='numFound'][.='0']"); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -361,8 +347,7 @@ public void testStringContext() { @Test public void testContextFilterOnInvalidFieldGivesNoSuggestions() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", @@ -378,15 +363,15 @@ public void testContextFilterOnInvalidFieldGivesNoSuggestions() { @Test public void testContextFilterUsesAnalyzer() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", SuggesterParams.SUGGEST_DICT, "suggest_blended_infix_suggester", SuggesterParams.SUGGEST_CONTEXT_FILTER_QUERY, - "CTx1", // Will not match due to case + "CTx1", + // Will not match due to case SuggesterParams.SUGGEST_Q, "examp"), "//lst[@name='suggest']/lst[@name='suggest_blended_infix_suggester']/lst[@name='examp']/int[@name='numFound'][.='0']"); @@ -396,8 +381,7 @@ public void testContextFilterUsesAnalyzer() { @Test public void testContextFilterWithHighlight() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD, "true", diff --git a/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java index e805c96b6ef6..6270a0abb4c8 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java @@ -60,15 +60,14 @@ public void tearDown() throws Exception { waitForWarming(); // rebuild suggesters with empty index assertQ( - req("qt", rh, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); } @Test public void testDocumentBased() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_dict", @@ -85,8 +84,7 @@ public void testDocumentBased() { "//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='40']"); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_dict", @@ -106,8 +104,7 @@ public void testDocumentBased() { @Test public void testExpressionBased() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_expr_dict", @@ -127,8 +124,7 @@ public void testExpressionBased() { @Test public void testFileBased() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_file_based", @@ -148,8 +144,7 @@ public void testFileBased() { @Test public void testMultiSuggester() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_dict", @@ -176,8 +171,7 @@ public void testMultiSuggester() { @Test public void testBuildAllSuggester() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_BUILD_ALL, "true", @@ -188,15 +182,14 @@ public void testBuildAllSuggester() { "//str[@name='command'][.='buildAll']"); assertQ( - req("qt", rh, SuggesterParams.SUGGEST_BUILD_ALL, "true"), + reqWithPath(rh, SuggesterParams.SUGGEST_BUILD_ALL, "true"), "//str[@name='command'][.='buildAll']"); } @Test public void testReloadAllSuggester() { assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_RELOAD_ALL, "true", @@ -207,7 +200,7 @@ public void testReloadAllSuggester() { "//str[@name='command'][.='reloadAll']"); assertQ( - req("qt", rh, SuggesterParams.SUGGEST_RELOAD_ALL, "true"), + reqWithPath(rh, SuggesterParams.SUGGEST_RELOAD_ALL, "true"), "//str[@name='command'][.='reloadAll']"); } @@ -216,8 +209,7 @@ public void testBadSuggesterName() { String fakeSuggesterName = "does-not-exist"; assertQEx( "No suggester named " + fakeSuggesterName + " was configured", - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, fakeSuggesterName, @@ -231,7 +223,7 @@ public void testBadSuggesterName() { "'" + SuggesterParams.SUGGEST_DICT + "' parameter not specified and no default suggester configured", - req("qt", rh, SuggesterParams.SUGGEST_Q, "exampel", SuggesterParams.SUGGEST_COUNT, "5"), + reqWithPath(rh, SuggesterParams.SUGGEST_Q, "exampel", SuggesterParams.SUGGEST_COUNT, "5"), SolrException.ErrorCode.BAD_REQUEST); } @@ -281,8 +273,7 @@ public void testDefaultBuildOnStartupNotStoredDict() throws Exception { // Validate that the suggester was built on new/reload core assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -302,8 +293,7 @@ public void testDefaultBuildOnStartupNotStoredDict() throws Exception { // buildOnCommit=false, this doc should not be in the suggester yet assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -318,8 +308,7 @@ public void testDefaultBuildOnStartupNotStoredDict() throws Exception { reloadCore(random().nextBoolean()); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -377,8 +366,7 @@ public void testDefaultBuildOnStartupStoredDict() throws Exception { .txt()); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -392,18 +380,12 @@ public void testDefaultBuildOnStartupStoredDict() throws Exception { // build the suggester manually assertQ( - req( - "qt", - rh, - SuggesterParams.SUGGEST_DICT, - suggester, - SuggesterParams.SUGGEST_BUILD, - "true"), + reqWithPath( + rh, SuggesterParams.SUGGEST_DICT, suggester, SuggesterParams.SUGGEST_BUILD, "true"), "//str[@name='command'][.='build']"); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -419,8 +401,7 @@ public void testDefaultBuildOnStartupStoredDict() throws Exception { // Validate that the suggester was loaded on new/reload core assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -440,8 +421,7 @@ public void testDefaultBuildOnStartupStoredDict() throws Exception { waitForWarming(); // buildOnCommit=false, this doc should not be in the suggester yet assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -456,8 +436,7 @@ public void testDefaultBuildOnStartupStoredDict() throws Exception { reloadCore(random().nextBoolean()); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -471,18 +450,12 @@ public void testDefaultBuildOnStartupStoredDict() throws Exception { // build the suggester manually assertQ( - req( - "qt", - rh, - SuggesterParams.SUGGEST_DICT, - suggester, - SuggesterParams.SUGGEST_BUILD, - "true"), + reqWithPath( + rh, SuggesterParams.SUGGEST_DICT, suggester, SuggesterParams.SUGGEST_BUILD, "true"), "//str[@name='command'][.='build']"); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -541,18 +514,12 @@ public void testLoadOnStartup() throws Exception { // build the suggester manually assertQ( - req( - "qt", - rh, - SuggesterParams.SUGGEST_DICT, - suggester, - SuggesterParams.SUGGEST_BUILD, - "true"), + reqWithPath( + rh, SuggesterParams.SUGGEST_DICT, suggester, SuggesterParams.SUGGEST_BUILD, "true"), "//str[@name='command'][.='build']"); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -568,8 +535,7 @@ public void testLoadOnStartup() throws Exception { // Validate that the suggester was loaded on core reload assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -585,8 +551,7 @@ public void testLoadOnStartup() throws Exception { // Validate that the suggester was loaded on new core assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggester, @@ -654,8 +619,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { // verify that this suggester is built (there was a commit in setUp) assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggesterFuzzy, @@ -676,8 +640,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { // The suggester should be empty assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggesterFuzzy, @@ -691,8 +654,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { // build the suggester manually assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggesterFuzzy, @@ -702,8 +664,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { // validate the suggester is built again assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggesterFuzzy, @@ -755,8 +716,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { reloadCore(createNewCores); // verify that this suggester is built (should build on startup) assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggestStartup, @@ -776,8 +736,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { waitForWarming(); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggestStartup, @@ -791,8 +750,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { // build the suggester manually assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggestStartup, @@ -801,8 +759,7 @@ private void doTestBuildOnStartup(boolean createNewCores) throws Exception { "//str[@name='command'][.='build']"); assertQ( - req( - "qt", + reqWithPath( rh, SuggesterParams.SUGGEST_DICT, suggestStartup, @@ -830,6 +787,6 @@ private void reloadCore(boolean createNewCore) throws Exception { waitForWarming(); } - assertQ(req("qt", "/select", "q", "*:*"), "//*[@numFound='11']"); + assertQ(reqWithPath("/select", "q", "*:*"), "//*[@numFound='11']"); } } diff --git a/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java b/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java index a2cbb5759bc0..584fc3bc6f8c 100644 --- a/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java +++ b/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java @@ -116,7 +116,7 @@ public void testBoolField() { // do atomic update assertU(adoc(sdoc("id", "7", "bindsto", Map.of("set", "1")))); assertQ( - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/bool[@name='bindsto'][.='true']"); diff --git a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java index 4c7010bb0c1b..9c7cc156c998 100644 --- a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java +++ b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java @@ -3433,7 +3433,7 @@ private void doTestPointFieldReturn(String field, String type, String[] values) if (Boolean.getBoolean("solr.index.updatelog.enabled")) { for (int i = 0; i < values.length; i++) { assertQ( - req("qt", "/get", "id", String.valueOf(i)), + reqWithPath("/get", "id", String.valueOf(i)), "//doc/" + type + "[@name='" + field + "'][.='" + values[i] + "']"); } } @@ -3458,7 +3458,7 @@ private void doTestPointFieldReturn(String field, String type, String[] values) if (Boolean.getBoolean("solr.index.updatelog.enabled")) { for (int i = 0; i < values.length; i++) { assertQ( - req("qt", "/get", "id", String.valueOf(i)), + reqWithPath("/get", "id", String.valueOf(i)), "//doc/" + type + "[@name='" + field + "'][.='" + values[i] + "']"); } } @@ -4080,7 +4080,7 @@ private void doTestPointFieldMultiValuedReturn(String fieldName, String type, St if (Boolean.getBoolean("solr.index.updatelog.enabled")) { for (int i = 0; i < 10; i++) { assertQ( - req("qt", "/get", "id", String.valueOf(i)), + reqWithPath("/get", "id", String.valueOf(i)), "//doc/arr[@name='" + fieldName + "']/" + type + "[.='" + numbers[i] + "']", "//doc/arr[@name='" + fieldName + "']/" + type + "[.='" + numbers[i + 10] + "']", "count(//doc/arr[@name='" + fieldName + "']/" + type + ")=2"); @@ -4091,7 +4091,7 @@ private void doTestPointFieldMultiValuedReturn(String fieldName, String type, St if (Boolean.getBoolean("solr.index.updatelog.enabled")) { for (int i = 0; i < 10; i++) { assertQ( - req("qt", "/get", "id", String.valueOf(i)), + reqWithPath("/get", "id", String.valueOf(i)), "//doc/arr[@name='" + fieldName + "']/" + type + "[.='" + numbers[i] + "']", "//doc/arr[@name='" + fieldName + "']/" + type + "[.='" + numbers[i + 10] + "']", "count(//doc/arr[@name='" + fieldName + "']/" + type + ")=2"); diff --git a/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java b/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java index 91447cf037d9..65555dc45601 100644 --- a/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java +++ b/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java @@ -73,10 +73,10 @@ public void test() throws Exception { assertU(adoc("id", "1", newFieldName, newFieldValue)); assertJQ(req("q", "id:1"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "1", "fl", "id," + newFieldName), + reqWithPath("/get", "id", "1", "fl", "id," + newFieldName), "=={'doc':{'id':'1'," + newFieldKeyValue + "}}"); assertJQ( - req("qt", "/get", "ids", "1", "fl", "id," + newFieldName), + reqWithPath("/get", "ids", "1", "fl", "id," + newFieldName), "=={'response':{'numFound':1,'start':0,'numFoundExact':true,'docs':[{'id':'1'," + newFieldKeyValue + "}]}}"); @@ -85,10 +85,10 @@ public void test() throws Exception { assertJQ(req("q", "id:1"), "/response/numFound==1"); assertJQ( - req("qt", "/get", "id", "1", "fl", "id," + newFieldName), + reqWithPath("/get", "id", "1", "fl", "id," + newFieldName), "=={'doc':{'id':'1'," + newFieldKeyValue + "}}"); assertJQ( - req("qt", "/get", "ids", "1", "fl", "id," + newFieldName), + reqWithPath("/get", "ids", "1", "fl", "id," + newFieldName), "=={'response':{'numFound':1,'start':0,'numFoundExact':true,'docs':[{'id':'1'," + newFieldKeyValue + "}]}}"); diff --git a/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java b/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java index 1d3d3ca45bda..2fee5d8f858b 100644 --- a/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java +++ b/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java @@ -93,7 +93,7 @@ public void testMultiValued() throws Exception { "/response/docs==[{'val2_ss':10,'val_ss':1}]"); assertJQ( - req("qt", "/get", "id", "42", "fl", "val_ss:val_i, val2_ss:10"), + reqWithPath("/get", "id", "42", "fl", "val_ss:val_i, val2_ss:10"), "/doc=={'val2_ss':10,'val_ss':1}"); } @@ -101,12 +101,12 @@ public void testMultiValuedRTG() throws Exception { // single value int using alias that matches multivalued dynamic field - via RTG assertJQ( - req("qt", "/get", "id", "42", "fl", "val_ss:val_i, val2_ss:10, subject"), + reqWithPath("/get", "id", "42", "fl", "val_ss:val_i, val2_ss:10, subject"), "/doc=={'val2_ss':10,'val_ss':1, 'subject':'aaa'}"); // also check real-time-get from transaction log assertJQ( - req("qt", "/get", "id", "99", "fl", "val_ss:val_i, val2_ss:10, subject"), + reqWithPath("/get", "id", "99", "fl", "val_ss:val_i, val2_ss:10, subject"), "/doc=={'val2_ss':10,'val_ss':1,'subject':'uncommitted'}"); } @@ -145,7 +145,7 @@ public void testAllRealFieldsRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( "id=" + id + ", fl=" + fl + " ... all real fields", - req("qt", "/get", "id", id, "wt", "xml", "fl", fl), + reqWithPath("/get", "id", id, "wt", "xml", "fl", fl), "count(//doc)=1", "//doc/str[@name='id']", "//doc/int[@name='val_i']", @@ -161,8 +161,7 @@ public void testFilterAndOneRealFieldRTG() { // only one of these docs should match... assertQ( "RTG w/ 2 ids & fq that only matches 1 uncommitted doc", - req( - "qt", + reqWithPath( "/get", "ids", "42,99", @@ -203,7 +202,7 @@ public void testScoreAndAllRealFieldsRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( "id=" + id + ", fl=" + fl + " ... score real fields", - req("qt", "/get", "id", id, "wt", "xml", "fl", fl), + reqWithPath("/get", "id", id, "wt", "xml", "fl", fl), "count(//doc)=1", "//doc/str[@name='id']", "//doc/int[@name='val_i']", @@ -244,7 +243,7 @@ public void testScoreAndExplicitRealFieldsRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( "id=" + id + ", fl=score,val_i", - req("qt", "/get", "id", id, "wt", "xml", "fl", "score,val_i"), + reqWithPath("/get", "id", id, "wt", "xml", "fl", "score,val_i"), "count(//doc)=1", "//doc/int[@name='val_i']", "//doc[count(*)=1]"); @@ -280,12 +279,11 @@ public void testFunctionsRTG() { for (String id : Arrays.asList("42", "99")) { for (SolrParams p : Arrays.asList( - params("qt", "/get", "id", id, "wt", "xml", "fl", "log(val_i),abs(val_i)"), - params( - "qt", "/get", "id", id, "wt", "xml", "fl", "log(val_i)", "fl", "abs(val_i)"))) { + params("id", id, "wt", "xml", "fl", "log(val_i),abs(val_i)"), + params("id", id, "wt", "xml", "fl", "log(val_i)", "fl", "abs(val_i)"))) { assertQ( "id=" + id + ", params=" + p, - req(p), + reqWithPath("/get", p), "count(//doc)=1", // true for both these specific docs "//doc/double[@name='log(val_i)'][.='0.0']", @@ -321,7 +319,7 @@ public void testFunctionsAndExplicitRTG() { params("fl", "log(val_i),val_i"), params("fl", "log(val_i)", "fl", "val_i"))) { assertQ( id + " " + p, - req(p, "qt", "/get", "wt", "xml", "id", id), + reqWithPath("/get", p, "wt", "xml", "id", id), "count(//doc)=1", // true for both these specific docs "//doc/double[@name='log(val_i)'][.='0.0']", @@ -377,7 +375,7 @@ public void testFunctionsAndScoreRTG() { params("fl", "score,log(val_i),abs(val_i)"))) { assertQ( "id=" + id + ", p=" + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/double[@name='log(val_i)']", "//doc/float[@name='abs(val_i)'][.='1.0']", @@ -415,7 +413,7 @@ public void testGlobsRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( id + ": fl=val_*", - req("qt", "/get", "id", id, "wt", "xml", "fl", "val_*"), + reqWithPath("/get", "id", id, "wt", "xml", "fl", "val_*"), "count(//doc)=1", "//doc/int[@name='val_i'][.=1]", "//doc[count(*)=1]"); @@ -424,7 +422,7 @@ public void testGlobsRTG() { params("fl", "val_*,subj*,ss*"), params("fl", "val_*", "fl", "subj*,ss*"))) { assertQ( id + ": " + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/int[@name='val_i'][.=1]", "//doc/str[@name='subject']", // value differs between docs @@ -464,7 +462,7 @@ public void testGlobsAndExplicitRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( id + " + fl=val_*,id", - req("qt", "/get", "id", id, "wt", "xml", "fl", "val_*,id"), + reqWithPath("/get", "id", id, "wt", "xml", "fl", "val_*,id"), "count(//doc)=1", "//doc/int[@name='val_i'][.=1]", "//doc/str[@name='id']", @@ -477,7 +475,7 @@ public void testGlobsAndExplicitRTG() { params("fl", "val_*", "fl", "subj*,id"))) { assertQ( id + " + " + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/int[@name='val_i'][.=1]", "//doc/str[@name='subject']", @@ -516,7 +514,7 @@ public void testGlobsAndScoreRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( id + ": fl=val_*,score", - req("qt", "/get", "id", id, "wt", "xml", "fl", "val_*,score"), + reqWithPath("/get", "id", id, "wt", "xml", "fl", "val_*,score"), "count(//doc)=1", "//doc/int[@name='val_i']", "//doc[count(*)=1]"); @@ -527,7 +525,7 @@ public void testGlobsAndScoreRTG() { params("fl", "val_*", "fl", "subj*,score"))) { assertQ( "" + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/int[@name='val_i']", "//doc/str[@name='subject']", @@ -573,7 +571,7 @@ public void testDocIdAugmenterRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( id + ": fl=[docid]", - req("qt", "/get", "id", id, "wt", "xml", "fl", "[docid]"), + reqWithPath("/get", "id", id, "wt", "xml", "fl", "[docid]"), "count(//doc)=1", "//doc/int[@name='[docid]'][.>=-1]", "//doc[count(*)=1]"); @@ -608,7 +606,7 @@ public void testAugmentersRTG() { "abs(val_i)"))) { assertQ( id + ": " + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/int[@name='[docid]'][.>=-1]", "//doc/float[@name='abs(val_i)'][.='1.0']", @@ -666,7 +664,7 @@ public void testAugmentersAndExplicitRTG() { "abs(val_i)"))) { assertQ( id + ": " + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/str[@name='id']", "//doc/int[@name='[docid]'][.>=-1]", @@ -724,8 +722,7 @@ public void testAugmentersAndScoreRTG() { for (String id : Arrays.asList("42", "99")) { assertQ( id, - req( - "qt", + reqWithPath( "/get", "id", id, @@ -756,7 +753,7 @@ public void testAugmentersAndScoreRTG() { assertQ( p.toString(), - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "//doc/int[@name='[docid]']", // TODO "//doc/float[@name='abs(val_i)'][.='1.0']", "//doc/int[@name='x_alias'][.=10]", @@ -821,7 +818,7 @@ public void testAugmentersGlobsExplicitAndScoreOhMyRTG() { for (SolrParams p : Arrays.asList(singleFl, multiFl)) { assertQ( id + ": " + p, - req(p, "qt", "/get", "id", id, "wt", "xml"), + reqWithPath("/get", p, "id", id, "wt", "xml"), "count(//doc)=1", "//doc/str[@name='id']", "//doc/int[@name='[docid]'][.>=-1]", diff --git a/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java b/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java index 44749171af4a..3ef6a1ab467e 100644 --- a/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java +++ b/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java @@ -162,8 +162,7 @@ public void testGetRealtime() throws Exception { "false")); assertJQ(req("q", "id:1"), "/response/numFound==0"); assertJQ( - req( - "qt", + reqWithPath( "/get", "id", "1", @@ -181,7 +180,7 @@ public void testGetRealtime() throws Exception { + ", a_b:false, a_bd:true, a_bdS:false, a_bs:[true,false],a_bds:[true,false],a_bdsS:[true,false]" + " }}"); assertJQ( - req("qt", "/get", "ids", "1", "fl", "id"), + reqWithPath("/get", "ids", "1", "fl", "id"), "=={" + " 'response':{'numFound':1,'start':0,'numFoundExact':true,'docs':[" + " {" @@ -195,8 +194,7 @@ public void testGetRealtime() throws Exception { // a cut-n-paste of the first big query, but this time it will be retrieved from the index // rather than the transaction log assertJQ( - req( - "qt", + reqWithPath( "/get", "id", "1", @@ -209,9 +207,9 @@ public void testGetRealtime() throws Exception { + ", a_l:-9999999999, a_ld:-9999999999, a_ldS:-9999999999, a_ls:[1,9999999999],a_lds:[1,9999999999],a_ldsS:[1,9999999999]" + " }}"); - assertJQ(req("qt", "/get", "id", "1", "fl", "id"), "=={'doc':{'id':'1'}}"); + assertJQ(reqWithPath("/get", "id", "1", "fl", "id"), "=={'doc':{'id':'1'}}"); assertJQ( - req("qt", "/get", "ids", "1", "fl", "id"), + reqWithPath("/get", "ids", "1", "fl", "id"), "=={" + " 'response':{'numFound':1,'start':0,'numFoundExact':true,'docs':[" + " {" @@ -221,28 +219,30 @@ public void testGetRealtime() throws Exception { assertU(delI("1")); assertJQ(req("q", "id:1"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':null}"); assertJQ( - req("qt", "/get", "ids", "1"), + reqWithPath("/get", "ids", "1"), "=={'response':{'numFound':0,'start':0,'numFoundExact':true,'docs':[]}}"); assertU(adoc("id", "10")); assertU(adoc("id", "11")); - assertJQ(req("qt", "/get", "id", "10", "fl", "id"), "=={'doc':{'id':'10'}}"); + assertJQ(reqWithPath("/get", "id", "10", "fl", "id"), "=={'doc':{'id':'10'}}"); assertU(delQ("id:10 foo_s:abcdef")); - assertJQ(req("qt", "/get", "id", "10"), "=={'doc':null}"); - assertJQ(req("qt", "/get", "id", "11", "fl", "id"), "=={'doc':{'id':'11'}}"); + assertJQ(reqWithPath("/get", "id", "10"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "11", "fl", "id"), "=={'doc':{'id':'11'}}"); // multivalued field assertU(adoc("id", "12", "val_ls", "1", "val_ls", "2")); assertJQ(req("q", "id:12"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "12", "fl", "id,val_ls"), "=={'doc':{'id':'12', 'val_ls':[1,2]}}"); + reqWithPath("/get", "id", "12", "fl", "id,val_ls"), + "=={'doc':{'id':'12', 'val_ls':[1,2]}}"); assertU(commit()); assertJQ( - req("qt", "/get", "id", "12", "fl", "id,val_ls"), "=={'doc':{'id':'12', 'val_ls':[1,2]}}"); + reqWithPath("/get", "id", "12", "fl", "id,val_ls"), + "=={'doc':{'id':'12', 'val_ls':[1,2]}}"); assertJQ(req("q", "id:12"), "/response/numFound==1"); SolrQueryRequest req = req(); @@ -255,7 +255,7 @@ public void testGetRealtime() throws Exception { assertU(adoc("id", "13")); // this should not need to open another realtime searcher - assertJQ(req("qt", "/get", "id", "11", "fl", "id", "fq", "id:11"), "=={doc:{id:'11'}}"); + assertJQ(reqWithPath("/get", "id", "11", "fl", "id", "fq", "id:11"), "=={doc:{id:'11'}}"); // assert that the same realtime searcher is still in effect (i.e. that we didn't // open a new searcher when we didn't have to). @@ -266,29 +266,20 @@ public void testGetRealtime() throws Exception { realtimeHolder2.decref(); // filter most likely different segment - assertJQ(req("qt", "/get", "id", "12", "fl", "id", "fq", "id:11"), "=={doc:null}"); + assertJQ(reqWithPath("/get", "id", "12", "fl", "id", "fq", "id:11"), "=={doc:null}"); // filter most likely same different segment - assertJQ(req("qt", "/get", "id", "12", "fl", "id", "fq", "id:13"), "=={doc:null}"); + assertJQ(reqWithPath("/get", "id", "12", "fl", "id", "fq", "id:13"), "=={doc:null}"); - assertJQ(req("qt", "/get", "id", "12", "fl", "id", "fq", "id:12"), "=={doc:{id:'12'}}"); + assertJQ(reqWithPath("/get", "id", "12", "fl", "id", "fq", "id:12"), "=={doc:{id:'12'}}"); assertU(adoc("id", "14")); assertU(adoc("id", "15")); // id list, with some in index and some not, first id from index. Also test multiple fq params. assertJQ( - req( - "qt", - "/get", - "ids", - "12,14,13,15", - "fl", - "id", - "fq", - "id:[10 TO 14]", - "fq", - "id:[13 TO 19]"), + reqWithPath( + "/get", "ids", "12,14,13,15", "fl", "id", "fq", "id:[10 TO 14]", "fq", "id:[13 TO 19]"), "/response/docs==[{id:'14'},{id:'13'}]"); assertU(adoc("id", "16")); @@ -296,20 +287,20 @@ public void testGetRealtime() throws Exception { // id list, with some in index and some not, first id from tlog assertJQ( - req("qt", "/get", "ids", "17,16,15,14", "fl", "id", "fq", "id:[15 TO 16]"), + reqWithPath("/get", "ids", "17,16,15,14", "fl", "id", "fq", "id:[15 TO 16]"), "/response/docs==[{id:'16'},{id:'15'}]"); // more complex filter assertJQ( - req("qt", "/get", "ids", "17,16,15,14", "fl", "id", "fq", "{!frange l=15 u=16}id"), + reqWithPath("/get", "ids", "17,16,15,14", "fl", "id", "fq", "{!frange l=15 u=16}id"), "/response/docs==[{id:'16'},{id:'15'}]"); // test with negative filter assertJQ( - req("qt", "/get", "ids", "15,14", "fl", "id", "fq", "-id:15"), + reqWithPath("/get", "ids", "15,14", "fl", "id", "fq", "-id:15"), "/response/docs==[{id:'14'}]"); assertJQ( - req("qt", "/get", "ids", "17,16,15,14", "fl", "id", "fq", "-id:[15 TO 17]"), + reqWithPath("/get", "ids", "17,16,15,14", "fl", "id", "fq", "-id:[15 TO 17]"), "/response/docs==[{id:'14'}]"); realtimeHolder.decref(); @@ -326,11 +317,11 @@ public void testVersions() throws Exception { assertJQ(req("q", "id:1"), "/response/numFound==0"); // test version is there from rtg - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // test version is there from the index assertU(commit()); - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // simulate an update from the leader version += 10; @@ -339,7 +330,7 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER)); // test version is there from rtg - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // simulate reordering: test that a version less than that does not take effect updateJ( @@ -347,7 +338,7 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER)); // test that version hasn't changed - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // simulate reordering: test that a delete w/ version less than that does not take affect // TODO: also allow passing version on delete instead of on URL? @@ -356,7 +347,7 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", Long.toString(version - 1))); // test that version hasn't changed - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // make sure reordering detection also works after a commit assertU(commit()); @@ -367,7 +358,7 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER)); // test that version hasn't changed - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // simulate reordering: test that a delete operation w/ version less than that does not take // effect @@ -376,7 +367,7 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", Long.toString(version - 1))); // test that version hasn't changed - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + version + "}}"); // now simulate a normal delete from the leader version += 5; @@ -390,7 +381,7 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER)); // test that it's still deleted - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':null}"); // test that we can remember the version of a delete operation after a commit assertU(commit()); @@ -399,14 +390,14 @@ public void testVersions() throws Exception { long version2 = deleteByQueryAndGetVersion("id:2", null); // test that it's still deleted - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':null}"); version = addAndGetVersion(sdoc("id", "2"), null); version2 = deleteByQueryAndGetVersion("id:2", null); assertTrue(Math.abs(version2) > version); // test that it's deleted - assertJQ(req("qt", "/get", "id", "2"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "2"), "=={'doc':null}"); version2 = Math.abs(version2) + 1000; updateJ( @@ -421,8 +412,8 @@ public void testVersions() throws Exception { "id:(3 4 5 6)", params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", Long.toString(-(version2 + 150)))); - assertJQ(req("qt", "/get", "id", "3"), "=={'doc':null}"); - assertJQ(req("qt", "/get", "id", "4", "fl", "id"), "=={'doc':{'id':'4'}}"); + assertJQ(reqWithPath("/get", "id", "3"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "4", "fl", "id"), "=={'doc':{'id':'4'}}"); updateJ( jsonAdd(sdoc("id", "5", "_version_", Long.toString(version2 + 201))), @@ -432,8 +423,8 @@ public void testVersions() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER)); // the DBQ should also have caused id:6 to be removed - assertJQ(req("qt", "/get", "id", "5", "fl", "id"), "=={'doc':{'id':'5'}}"); - assertJQ(req("qt", "/get", "id", "6"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "5", "fl", "id"), "=={'doc':{'id':'5'}}"); + assertJQ(reqWithPath("/get", "id", "6"), "=={'doc':null}"); assertU(commit()); } @@ -574,7 +565,8 @@ public void testOptimisticLocking() throws Exception { long lastVersion = version2; // sanity test that we see the right version via rtg - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + lastVersion + "}}"); + assertJQ( + reqWithPath("/get", "id", "1"), "=={'doc':{'id':'1','_version_':" + lastVersion + "}}"); } // @Test @@ -883,14 +875,13 @@ public void run() { boolean filteredOut = false; SolrQueryRequest sreq; if (realTime) { - ModifiableSolrParams p = - params("wt", "json", "qt", "/get", "ids", Integer.toString(id)); + ModifiableSolrParams p = params("wt", "json", "ids", Integer.toString(id)); if (rand.nextInt(100) < filteredGetPercent) { int idToFilter = rand.nextBoolean() ? id : rand.nextInt(ndocs); filteredOut = idToFilter != id; p.add("fq", "id:" + idToFilter); } - sreq = req(p); + sreq = reqWithPath("/get", p); } else { sreq = req("wt", "json", "q", "id:" + Integer.toString(id), "omitHeader", "true"); diff --git a/solr/core/src/test/org/apache/solr/search/TestRecovery.java b/solr/core/src/test/org/apache/solr/search/TestRecovery.java index e20a2d8cf271..2a40116c2319 100644 --- a/solr/core/src/test/org/apache/solr/search/TestRecovery.java +++ b/solr/core/src/test/org/apache/solr/search/TestRecovery.java @@ -205,7 +205,7 @@ public void testLogReplay() throws Exception { addAndGetVersion(sdoc("id", "A12", "val_i_dvo", map("set", 2)), null)); // in-place update assertJQ(req("q", "*:*"), "/response/numFound==0"); - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); h.close(); createCore(); @@ -218,7 +218,7 @@ public void testLogReplay() throws Exception { assertJQ(req("q", "*:*"), "/response/numFound==0"); // make sure we can still access versions after a restart - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); assertEquals( UpdateLog.State.REPLAYING, h.getCore().getUpdateHandler().getUpdateLog().getState()); @@ -250,7 +250,7 @@ public void testLogReplay() throws Exception { logReplay.release(1000); // make sure we can still access versions during recovery - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); // wait until recovery has finished assertTrue(logReplayFinish.tryAcquire(timeout, TimeUnit.SECONDS)); @@ -274,7 +274,7 @@ public void testLogReplay() throws Exception { 0.0); // make sure we can still access versions after recovery - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); assertU(adoc("id", "A2")); assertU(adoc("id", "A3")); @@ -708,12 +708,14 @@ public void testBuffering() throws Exception { deleteAndGetVersion("B1", params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", v2010_del)); assertJQ( - req("qt", "/get", "getVersions", "6"), "=={'versions':[" + versionListFirstCheck + "]}"); + reqWithPath("/get", "getVersions", "6"), + "=={'versions':[" + versionListFirstCheck + "]}"); assertU(commit()); assertJQ( - req("qt", "/get", "getVersions", "6"), "=={'versions':[" + versionListFirstCheck + "]}"); + reqWithPath("/get", "getVersions", "6"), + "=={'versions':[" + versionListFirstCheck + "]}"); // updates should be buffered, so we should not see any results yet. assertJQ(req("q", "*:*"), "/response/numFound==0"); @@ -721,7 +723,7 @@ public void testBuffering() throws Exception { // real-time get should also not show anything (this could change in the future), // but it's currently used for validating version numbers too, so it would // be bad for updates to be visible if we're just buffering. - assertJQ(req("qt", "/get", "id", "B3"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "B3"), "=={'doc':null}"); var actualBufferedOpsValue = SolrMetricTestUtils.getGaugeDatapoint( @@ -746,7 +748,7 @@ public void testBuffering() throws Exception { assertEquals(6, actualAppliedBufferedOpsValue, 0.0); assertThatJQ( - req("qt", "/get", "getVersions", "6"), + reqWithPath("/get", "getVersions", "6"), "Incorrect ordering of versions during applyBufferedUpdates", versionsMatch( 6, @@ -771,7 +773,7 @@ public void testBuffering() throws Exception { ulog.bufferUpdates(); assertEquals(UpdateLog.State.BUFFERING, ulog.getState()); - Long ver = getVer(req("qt", "/get", "id", "B3")); + Long ver = getVer(reqWithPath("/get", "id", "B3")); assertEquals(Long.valueOf(v1030), ver); // add a reordered doc that shouldn't overwrite one in the index @@ -803,7 +805,7 @@ public void testBuffering() throws Exception { params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", v3000_del)); assertThatJQ( - req("qt", "/get", "getVersions", "13"), + reqWithPath("/get", "getVersions", "13"), "Incorrect versions during buffering", versionsMatch( 13, @@ -963,7 +965,7 @@ public void testDropBuffered() throws Exception { assertEquals(2, rinfo.adds); assertThatJQ( - req("qt", "/get", "getVersions", "2"), + reqWithPath("/get", "getVersions", "2"), "Wrong updates after applyBufferedUpdates", versionsMatch( 2, @@ -1024,7 +1026,7 @@ public void testDropBuffered() throws Exception { // Note that the v101->v103 are dropped, therefore it does not present in RTG assertThatJQ( - req("qt", "/get", "getVersions", "6"), + reqWithPath("/get", "getVersions", "6"), "Incorrect versions after applyBufferedUpdates", versionsMatch( 6, @@ -1061,7 +1063,8 @@ public void testDropBuffered() throws Exception { assertU(commit()); - assertJQ(req("qt", "/get", "getVersions", "2"), "=={'versions':[" + v302 + "," + v301 + "]}"); + assertJQ( + reqWithPath("/get", "getVersions", "2"), "=={'versions':[" + v302 + "," + v301 + "]}"); assertJQ( req("q", "*:*", "sort", "_version_ desc", "fl", "id,_version_", "rows", "2"), @@ -1154,7 +1157,7 @@ public void testBufferedMultipleCalls() throws Exception { assertEquals(2, rinfo.adds); assertThatJQ( - req("qt", "/get", "getVersions", "2"), + reqWithPath("/get", "getVersions", "2"), "Wrong updates after applyBufferedUpdates", versionsMatch( 2, @@ -1214,7 +1217,7 @@ public void testBufferedMultipleCalls() throws Exception { + "]"); assertThatJQ( - req("qt", "/get", "getVersions", "6"), + reqWithPath("/get", "getVersions", "6"), "Incorrect versions after applyBufferedUpdates", versionsMatch( 6, @@ -1357,7 +1360,7 @@ public void testExistOldBufferLog() throws Exception { "Timeout waiting for finish replay updates", () -> h.getCore().getUpdateHandler().getUpdateLog().getState() == UpdateLog.State.ACTIVE); - assertJQ(req("qt", "/get", "id", "Q7"), "/doc/id==Q7"); + assertJQ(reqWithPath("/get", "id", "Q7"), "/doc/id==Q7"); } finally { UpdateLog.testing_logReplayHook = null; UpdateLog.testing_logReplayFinishHook = null; @@ -1391,7 +1394,7 @@ public void testVersionsOnRestart() throws Exception { assertTrue(D1Version2 > D1Version1); assertJQ( - req("qt", "/get", "getVersions", "2"), + reqWithPath("/get", "getVersions", "2"), "/versions==[" + D1Version2 + "," + D2Version1 + "]"); } @@ -1508,12 +1511,12 @@ public void testRemoveOldLogs() throws Exception { expectedToRetain + docsPerBatch); // not yet committed, so one more tlog could slip in assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, versExpected))); assertU(commit()); versExpected = Math.min(numIndexed, expectedToRetain); assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, versExpected))); assertEquals(Math.min(i, ulog.getMaxNumLogsToKeep()), ulog.getLogList(logDir).length); } @@ -1526,13 +1529,13 @@ public void testRemoveOldLogs() throws Exception { numIndexed += docsPerBatch; versExpected = Math.min(numIndexed, expectedToRetain); assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, versExpected))); assertU(commit()); expectedToRetain = expectedToRetain - 1; // we lose a log entry due to the commit record versExpected = Math.min(numIndexed, expectedToRetain); assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, versExpected))); // previous logs should be gone now @@ -1545,7 +1548,7 @@ public void testRemoveOldLogs() throws Exception { // test we can get versions while replay is happening assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, expectedToRetain))); logReplay.release(1000); @@ -1554,7 +1557,7 @@ public void testRemoveOldLogs() throws Exception { expectedToRetain = expectedToRetain - 1; // we lose a log entry due to the commit record made by recovery assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, expectedToRetain))); docsPerBatch = ulog.getNumRecordsToKeep() + 20; @@ -1564,12 +1567,12 @@ public void testRemoveOldLogs() throws Exception { addDocs(docsPerBatch, numIndexed, versions); numIndexed += docsPerBatch; assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, expectedToRetain))); assertU(commit()); expectedToRetain = expectedToRetain - 1; // we lose a log entry due to the commit record assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, expectedToRetain))); // previous logs should be gone now @@ -1597,7 +1600,7 @@ public void testRemoveOldLogs() throws Exception { createCore(); // we should still be able to get the list of versions (not including the trashed log file) assertJQ( - req("qt", "/get", "getVersions", "" + maxReq), + reqWithPath("/get", "getVersions", "" + maxReq), "/versions==" + versions.subList(0, Math.min(maxReq, expectedToRetain))); resetExceptionIgnores(); @@ -1677,9 +1680,9 @@ public void testTruncatedLog() throws Exception { // This currently skips the bad log file and also returns the version of the clearIndex (del // *:*) - // assertJQ(req("qt","/get", "getVersions","6"), "/versions==[106,105,104]"); + // assertJQ(reqWithPath("/get", "getVersions", "6"), "/versions==[106,105,104]"); assertJQ( - req("qt", "/get", "getVersions", "3"), + reqWithPath("/get", "getVersions", "3"), "/versions==[" + v106 + "," + v105 + "," + v104 + "]"); } finally { @@ -1742,7 +1745,7 @@ public void testCorruptLog() throws Exception { // This currently skips the bad log file and also returns the version of the clearIndex (del // *:*) assertJQ( - req("qt", "/get", "getVersions", "3"), + reqWithPath("/get", "getVersions", "3"), "/versions==[" + v106 + "," + v105 + "," + v104 + "]"); assertU(commit()); @@ -1906,7 +1909,7 @@ public void testLogReplayWithInPlaceUpdatesAndDeletes() throws Exception { assertJQ(req("q", "*:*"), "/response/numFound==0"); - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); h.close(); createCore(); @@ -1919,13 +1922,13 @@ public void testLogReplayWithInPlaceUpdatesAndDeletes() throws Exception { assertJQ(req("q", "*:*"), "/response/numFound==0"); // make sure we can still access versions after a restart - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); // unblock recovery logReplay.release(1000); // make sure we can still access versions during recovery - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); // wait until recovery has finished assertTrue(logReplayFinish.tryAcquire(timeout, TimeUnit.SECONDS)); @@ -1940,7 +1943,7 @@ public void testLogReplayWithInPlaceUpdatesAndDeletes() throws Exception { assertJQ(req("q", "id:A5"), "/response/numFound==0"); // make sure we can still access versions after recovery - assertJQ(req("qt", "/get", "getVersions", "" + versions.size()), "/versions==" + versions); + assertJQ(reqWithPath("/get", "getVersions", "" + versions.size()), "/versions==" + versions); assertU(adoc("id", "A10")); diff --git a/solr/core/src/test/org/apache/solr/search/TestReload.java b/solr/core/src/test/org/apache/solr/search/TestReload.java index ecf88cfaedaa..f9f046763781 100644 --- a/solr/core/src/test/org/apache/solr/search/TestReload.java +++ b/solr/core/src/test/org/apache/solr/search/TestReload.java @@ -37,13 +37,13 @@ public void testGetRealtimeReload() throws Exception { assertU(commit("softCommit", "true")); // should cause a RTG searcher to be opened assertJQ( - req("qt", "/get", "id", "1", "fl", "id,_version_"), + reqWithPath("/get", "id", "1", "fl", "id,_version_"), "=={'doc':{'id':'1','_version_':" + version + "}}"); h.reload(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,_version_"), + reqWithPath("/get", "id", "1", "fl", "id,_version_"), "=={'doc':{'id':'1','_version_':" + version + "}}"); assertU(commit("softCommit", "true")); // open a normal (caching) NRT searcher @@ -75,7 +75,7 @@ public void testGetRealtimeReload() throws Exception { // RTG should always be able to see the last version // System.out.println("!!! rtg"); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,_version_"), + reqWithPath("/get", "id", "1", "fl", "id,_version_"), "=={'doc':{'id':'1','_version_':" + version + "}}"); } diff --git a/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java b/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java index 299a8b82cf08..e1148b2ec126 100644 --- a/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java +++ b/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java @@ -323,7 +323,7 @@ public void run() { } SolrQueryRequest sreq; if (realTime) { - sreq = req("wt", "json", "qt", "/get", "ids", Integer.toString(id)); + sreq = reqWithPath("/get", "wt", "json", "ids", Integer.toString(id)); } else { sreq = req("wt", "json", "q", "id:" + Integer.toString(id), "omitHeader", "true"); diff --git a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java index 54917fa7399e..16fedf9cac3e 100644 --- a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java +++ b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java @@ -324,7 +324,7 @@ public void run() { } SolrQueryRequest sreq; if (realTime) { - sreq = req("wt", "json", "qt", "/get", "ids", Integer.toString(id)); + sreq = reqWithPath("/get", "wt", "json", "ids", Integer.toString(id)); } else { sreq = req("wt", "json", "q", "id:" + Integer.toString(id), "omitHeader", "true"); diff --git a/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java b/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java index 3314b913f6dd..35ce1aabd3d2 100644 --- a/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java +++ b/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java @@ -288,7 +288,7 @@ public void run() { } SolrQueryRequest sreq; if (realTime) { - sreq = req("wt", "json", "qt", "/get", "ids", Integer.toString(id)); + sreq = reqWithPath("/get", "wt", "json", "ids", Integer.toString(id)); } else { sreq = req("wt", "json", "q", "id:" + Integer.toString(id), "omitHeader", "true"); diff --git a/solr/core/src/test/org/apache/solr/search/TestStressVersions.java b/solr/core/src/test/org/apache/solr/search/TestStressVersions.java index 03adc37a47ad..72c99bf3ba82 100644 --- a/solr/core/src/test/org/apache/solr/search/TestStressVersions.java +++ b/solr/core/src/test/org/apache/solr/search/TestStressVersions.java @@ -231,7 +231,7 @@ public void run() { } SolrQueryRequest sreq; if (realTime) { - sreq = req("wt", "json", "qt", "/get", "ids", Integer.toString(id)); + sreq = reqWithPath("/get", "wt", "json", "ids", Integer.toString(id)); } else { sreq = req("wt", "json", "q", "id:" + Integer.toString(id), "omitHeader", "true"); diff --git a/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java b/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java index 9091f6501841..3a642df514fa 100644 --- a/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java @@ -102,11 +102,10 @@ public void test() throws Exception { @Test public void testOnlyMorePopularWithExtendedResults() { assertQ( - req( + reqWithPath( + "/spellCheckCompRH", "q", "teststop:fox", - "qt", - "/spellCheckCompRH", SpellCheckComponent.COMPONENT_NAME, "true", SpellingParams.SPELLCHECK_DICT, diff --git a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java index 382ed6333709..678ff73d8488 100644 --- a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java @@ -219,7 +219,8 @@ public void testCollationWithHypens() { public void testCollateWithOverride() { assertQ( - req( + reqWithPath( + "/spellCheckCompRH", SpellCheckComponent.COMPONENT_NAME, "true", SpellCheckComponent.SPELLCHECK_DICT, @@ -232,8 +233,6 @@ public void testCollateWithOverride() { "10", SpellingParams.SPELLCHECK_MAX_COLLATIONS, "10", - "qt", - "/spellCheckCompRH", "defType", "edismax", "qf", @@ -244,7 +243,8 @@ public void testCollateWithOverride() { "partisian politcal mashine"), "//lst[@name='spellcheck']/lst[@name='collations']/str[@name='collation']='parisian political machine'"); assertQ( - req( + reqWithPath( + "/spellCheckCompRH", SpellCheckComponent.COMPONENT_NAME, "true", SpellCheckComponent.SPELLCHECK_DICT, @@ -257,8 +257,6 @@ public void testCollateWithOverride() { "10", SpellingParams.SPELLCHECK_MAX_COLLATIONS, "10", - "qt", - "/spellCheckCompRH", "defType", "edismax", "qf", @@ -504,11 +502,10 @@ public void testContextSensitiveCollate() { String[] dictionary = {"direct", "default_teststop"}; for (int i = 0; i <= 1; i++) { assertQ( - req( + reqWithPath( + "/spellCheckCompRH", "q", "teststop:(flew AND form AND heathrow)", - "qt", - "/spellCheckCompRH", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -544,11 +541,10 @@ public void testContextSensitiveCollate() { "//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/lst[@name='misspellingsAndCorrections']/str[@name='form']='from'"); assertQ( - req( + reqWithPath( + "/spellCheckCompRH", "q", "teststop:(june AND customs)", - "qt", - "/spellCheckCompRH", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -579,13 +575,12 @@ public void testContextSensitiveCollate() { "//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/lst[@name='misspellingsAndCorrections']/str[@name='june']='jane'"); // SOLR-5090, alternativeTermCount==0 was being evaluated, would sometimes throw NPE assertQ( - req( + reqWithPath( + "/spellCheckCompRH", "q", "teststop:(june customs)", "mm", "2", - "qt", - "/spellCheckCompRH", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -620,13 +615,11 @@ public void testEstimatedHitCounts() { SpellingParams.SPELLCHECK_MAX_COLLATIONS, "1", SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, - "true", - "qt", - "/spellCheckCompRH"); + "true"); // default case, no SPELLCHECK_COLLATE_MAX_COLLECT_DOCS should be exact num hits assertQ( - req(reusedParams, CommonParams.Q, "teststop:metnoia"), + reqWithPath("/spellCheckCompRH", reusedParams, CommonParams.Q, "teststop:metnoia"), xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'", xpathPrefix + "long[@name='hits']=6"); @@ -635,7 +628,8 @@ public void testEstimatedHitCounts() { // "estimating" and getting exact number as well. for (String val : new String[] {"0", "30", "100", "10000"}) { assertQ( - req( + reqWithPath( + "/spellCheckCompRH", reusedParams, CommonParams.Q, "teststop:metnoia", @@ -651,7 +645,8 @@ public void testEstimatedHitCounts() { for (int iter = 0; iter < iters; iter++) { final int val = TestUtil.nextInt(random(), 1, 17); assertQ( - req( + reqWithPath( + "/spellCheckCompRH", reusedParams, CommonParams.Q, "teststop:metnoia", @@ -687,7 +682,8 @@ public void testEstimatedHitCounts() { hitsXPath += "[.=" + NUM_DOCS_WITH_TERM_EVERYOTHER + "]"; } assertQ( - req( + reqWithPath( + "/spellCheckCompRH", reusedParams, CommonParams.Q, "teststop:everother", diff --git a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorWithCollapseTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorWithCollapseTest.java index 2a36cb7d9519..80716aaa64ba 100644 --- a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorWithCollapseTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorWithCollapseTest.java @@ -62,7 +62,8 @@ public void test() { params(CommonParams.FQ, "{!collapse tag=collapser field=group_i}") }) { assertQ( - req( + reqWithPath( + "/spellCheckCompRH_Direct", params, SpellCheckComponent.COMPONENT_NAME, "true", @@ -78,8 +79,6 @@ public void test() { "1", CommonParams.Q, "a_s:lpve", - CommonParams.QT, - "/spellCheckCompRH_Direct", SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, "5", "expand", diff --git a/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java b/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java index 59d906dc257f..87db8f6176ae 100644 --- a/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/WordBreakSolrSpellCheckerTest.java @@ -160,11 +160,10 @@ public void testStandAlone() throws Exception { @Test public void testInConjunction() { assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:(paintable pine apple good ness)", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.SPELLCHECK_BUILD, @@ -232,11 +231,10 @@ public void testInConjunction() { @Test public void testCollate() { assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:(paintable pine apple godness)", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.SPELLCHECK_BUILD, @@ -268,11 +266,10 @@ public void testCollate() { "//lst[@name='collation'][10]/lst[@name='misspellingsAndCorrections']/str[@name='apple']='ample'", "//lst[@name='collation'][10]/lst[@name='misspellingsAndCorrections']/str[@name='godness']='goodness'"); assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:(pine AND apple)", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -291,11 +288,10 @@ public void testCollate() { "//lst[@name='collation'][2 ]/str[@name='collationQuery']='lowerfilt:(pineapple)'", "//lst[@name='collation'][3 ]/str[@name='collationQuery']='lowerfilt:((pi AND ne) AND ample)'"); assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:pine AND NOT lowerfilt:apple", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -313,11 +309,10 @@ public void testCollate() { "//lst[@name='collation'][1 ]/str[@name='collationQuery']='lowerfilt:line AND NOT lowerfilt:ample'", "//lst[@name='collation'][2 ]/str[@name='collationQuery']='lowerfilt:(pi AND ne) AND NOT lowerfilt:ample'"); assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:pine NOT lowerfilt:apple", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -335,11 +330,10 @@ public void testCollate() { "//lst[@name='collation'][1 ]/str[@name='collationQuery']='lowerfilt:line NOT lowerfilt:ample'", "//lst[@name='collation'][2 ]/str[@name='collationQuery']='lowerfilt:(pi AND ne) NOT lowerfilt:ample'"); assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:(+pine -apple)", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -357,11 +351,10 @@ public void testCollate() { "//lst[@name='collation'][1 ]/str[@name='collationQuery']='lowerfilt:(+line -ample)'", "//lst[@name='collation'][2 ]/str[@name='collationQuery']='lowerfilt:(+pi +ne -ample)'"); assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "lowerfilt:(+printableinpuntableplantable)", - "qt", - "/spellCheckWithWordbreak", "indent", "true", SpellCheckComponent.COMPONENT_NAME, @@ -378,11 +371,10 @@ public void testCollate() { "1"), "//lst[@name='collation'][1 ]/str[@name='collationQuery']='lowerfilt:(+printable +in +puntable +plantable)'"); assertQ( - req( + reqWithPath( + "/spellCheckWithWordbreak", "q", "zxcv AND qwtp AND fghj", - "qt", - "/spellCheckWithWordbreak", "defType", "edismax", "qf", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java index 78984412cabc..314d245fbeb7 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTest.java @@ -52,8 +52,7 @@ public void testSuggestions() { assertU(commit()); // configured to do a rebuild on commit assertQ( - req( - "qt", + reqWithPath( requestUri, "q", "ac", @@ -76,8 +75,7 @@ public void testReload() throws Exception { waitForWarming(); assertQ( - req( - "qt", + reqWithPath( requestUri, "q", "ac", @@ -95,8 +93,7 @@ public void testRebuild() { addDocs(); assertU(commit()); assertQ( - req( - "qt", + reqWithPath( requestUri, "q", "ac", @@ -108,8 +105,7 @@ public void testRebuild() { assertU(adoc("id", "4", "text", "actually")); assertU(commit()); assertQ( - req( - "qt", + reqWithPath( requestUri, "q", "ac", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzeInfixSuggestions.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzeInfixSuggestions.java index 3224f9b8894b..0217b63ddfbc 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzeInfixSuggestions.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzeInfixSuggestions.java @@ -27,26 +27,25 @@ public class TestAnalyzeInfixSuggestions extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); - assertQ(req("qt", URI_DEFAULT, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); - assertQ(req("qt", URI_SUGGEST_DEFAULT, "q", "", SuggesterParams.SUGGEST_BUILD_ALL, "true")); + assertQ(reqWithPath(URI_DEFAULT, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI_SUGGEST_DEFAULT, "q", "", SuggesterParams.SUGGEST_BUILD_ALL, "true")); } public void testSingle() { assertQ( - req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "1"), + reqWithPath(URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "1"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='Japanese Autocomplete and Japanese Highlighter broken']"); assertQ( - req("qt", URI_DEFAULT, "q", "high", SpellingParams.SPELLCHECK_COUNT, "1"), + reqWithPath(URI_DEFAULT, "q", "high", SpellingParams.SPELLCHECK_COUNT, "1"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='high']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='high']/arr[@name='suggestion']/str[1][.='Japanese Autocomplete and Japanese Highlighter broken']"); /* equivalent SolrSuggester, SuggestComponent tests */ assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "japan", @@ -58,8 +57,7 @@ public void testSingle() { "//lst[@name='suggest']/lst[@name='analyzing_infix_suggest_default']/lst[@name='japan']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='Japanese Autocomplete and Japanese Highlighter broken']"); assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "high", @@ -74,18 +72,18 @@ public void testSingle() { public void testMultiple() { assertQ( - req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "2"), + reqWithPath(URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "2"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='2']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='Japanese Autocomplete and Japanese Highlighter broken']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[2][.='Add Japanese Kanji number normalization to Kuromoji']"); assertQ( - req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='3']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='Japanese Autocomplete and Japanese Highlighter broken']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[2][.='Add Japanese Kanji number normalization to Kuromoji']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[3][.='Add decompose compound Japanese Katakana token capability to Kuromoji']"); assertQ( - req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "4"), + reqWithPath(URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "4"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='3']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='Japanese Autocomplete and Japanese Highlighter broken']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[2][.='Add Japanese Kanji number normalization to Kuromoji']", @@ -93,8 +91,7 @@ public void testMultiple() { /* SolrSuggester, SuggestComponent tests: allTermsRequire (true), highlight (true) */ assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "japan", @@ -107,8 +104,7 @@ public void testMultiple() { "//lst[@name='suggest']/lst[@name='analyzing_infix_suggest_default']/lst[@name='japan']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='Add Japanese Kanji number normalization to Kuromoji']"); assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "japanese ka", @@ -123,8 +119,7 @@ public void testMultiple() { public void testWithoutHighlight() { assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "japan", @@ -139,8 +134,7 @@ public void testWithoutHighlight() { public void testNotAllTermsRequired() { assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "japanese javanese", @@ -154,8 +148,7 @@ public void testNotAllTermsRequired() { "//lst[@name='suggest']/lst[@name='analyzing_infix_suggest_not_all_terms_required']/lst[@name='japanese javanese']/arr[@name='suggestions']/lst[3]/str[@name='term'][.='Add decompose compound Japanese Katakana token capability to Kuromoji']"); assertQ( - req( - "qt", + reqWithPath( URI_SUGGEST_DEFAULT, "q", "just number", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzedSuggestions.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzedSuggestions.java index 41079727ef7e..71d0fde39a7f 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzedSuggestions.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestAnalyzedSuggestions.java @@ -26,31 +26,31 @@ public class TestAnalyzedSuggestions extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); - assertQ(req("qt", URI, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); } public void test() { assertQ( - req("qt", URI, "q", "hokk", SpellingParams.SPELLCHECK_COUNT, "1"), + reqWithPath(URI, "q", "hokk", SpellingParams.SPELLCHECK_COUNT, "1"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='hokk']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='hokk']/arr[@name='suggestion']/str[1][.='北海道']"); assertQ( - req("qt", URI, "q", "ほっk", SpellingParams.SPELLCHECK_COUNT, "1"), + reqWithPath(URI, "q", "ほっk", SpellingParams.SPELLCHECK_COUNT, "1"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ほっk']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ほっk']/arr[@name='suggestion']/str[1][.='北海道']"); assertQ( - req("qt", URI, "q", "ホッk", SpellingParams.SPELLCHECK_COUNT, "1"), + reqWithPath(URI, "q", "ホッk", SpellingParams.SPELLCHECK_COUNT, "1"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/arr[@name='suggestion']/str[1][.='北海道']"); assertQ( - req("qt", URI, "q", "ホッk", SpellingParams.SPELLCHECK_COUNT, "1"), + reqWithPath(URI, "q", "ホッk", SpellingParams.SPELLCHECK_COUNT, "1"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/arr[@name='suggestion']/str[1][.='北海道']"); } public void testMultiple() { assertQ( - req("qt", URI, "q", "h", SpellingParams.SPELLCHECK_COUNT, "2"), + reqWithPath(URI, "q", "h", SpellingParams.SPELLCHECK_COUNT, "2"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='h']/int[@name='numFound'][.='2']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='h']/arr[@name='suggestion']/str[1][.='話した']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='h']/arr[@name='suggestion']/str[2][.='北海道']"); diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestBlendedInfixSuggestions.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestBlendedInfixSuggestions.java index 2157efd28221..ed798be10170 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestBlendedInfixSuggestions.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestBlendedInfixSuggestions.java @@ -25,13 +25,12 @@ public class TestBlendedInfixSuggestions extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); - assertQ(req("qt", URI, "q", "", SuggesterParams.SUGGEST_BUILD_ALL, "true")); + assertQ(reqWithPath(URI, "q", "", SuggesterParams.SUGGEST_BUILD_ALL, "true")); } public void testLinearBlenderType() { assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -53,8 +52,7 @@ public void testLinearBlenderType() { public void testReciprocalBlenderType() { assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -78,8 +76,7 @@ public void testReciprocalBlenderType() { testExponentialReciprocalBlenderTypeExponent1() { // exponent=1 will give same output as // reciprocal assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -101,8 +98,7 @@ public void testReciprocalBlenderType() { public void testExponentialReciprocalBlenderType() { // default is exponent=2.0 assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -124,8 +120,7 @@ public void testExponentialReciprocalBlenderType() { // default is exponent=2.0 public void testMultiSuggester() { assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -160,8 +155,7 @@ public void testMultiSuggester() { public void testSuggestCount() { assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -172,8 +166,7 @@ public void testSuggestCount() { "//lst[@name='suggest']/lst[@name='blended_infix_suggest_reciprocal']/lst[@name='the']/int[@name='numFound'][.='1']"); assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -184,8 +177,7 @@ public void testSuggestCount() { "//lst[@name='suggest']/lst[@name='blended_infix_suggest_reciprocal']/lst[@name='the']/int[@name='numFound'][.='2']"); assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", @@ -196,8 +188,7 @@ public void testSuggestCount() { "//lst[@name='suggest']/lst[@name='blended_infix_suggest_reciprocal']/lst[@name='the']/int[@name='numFound'][.='3']"); assertQ( - req( - "qt", + reqWithPath( URI, "q", "the", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestFileDictionaryLookup.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestFileDictionaryLookup.java index 093a0c06b59f..2d9abe63e278 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestFileDictionaryLookup.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestFileDictionaryLookup.java @@ -27,8 +27,7 @@ public class TestFileDictionaryLookup extends SolrTestCaseJ4 { public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "", @@ -42,8 +41,7 @@ public void testDefault() { // tests to demonstrate default maxEdit parameter (value: 1), control for testWithMaxEdit2 assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chagn", @@ -62,8 +60,7 @@ public void testDefault() { + "']/lst[@name='chagn']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='change']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chacn", @@ -82,8 +79,7 @@ public void testDefault() { + "']/lst[@name='chacn']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='change']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chagr", @@ -99,8 +95,7 @@ public void testDefault() { + "']/lst[@name='chagr']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='charge']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chanr", @@ -113,8 +108,7 @@ public void testDefault() { + "']/lst[@name='chanr']/int[@name='numFound'][.='3']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "cyhnce", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestFreeTextSuggestions.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestFreeTextSuggestions.java index 3bfa6130f381..c778e26492f5 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestFreeTextSuggestions.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestFreeTextSuggestions.java @@ -25,13 +25,12 @@ public class TestFreeTextSuggestions extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); - assertQ(req("qt", URI, "q", "", SuggesterParams.SUGGEST_BUILD_ALL, "true")); + assertQ(reqWithPath(URI, "q", "", SuggesterParams.SUGGEST_BUILD_ALL, "true")); } public void test() { assertQ( - req( - "qt", + reqWithPath( URI, "q", "foo b", @@ -43,8 +42,7 @@ public void test() { "//lst[@name='suggest']/lst[@name='free_text_suggest']/lst[@name='foo b']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='foo bar']"); assertQ( - req( - "qt", + reqWithPath( URI, "q", "foo ", @@ -57,8 +55,7 @@ public void test() { "//lst[@name='suggest']/lst[@name='free_text_suggest']/lst[@name='foo ']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='foo bee']"); assertQ( - req( - "qt", + reqWithPath( URI, "q", "foo", @@ -69,8 +66,7 @@ public void test() { "//lst[@name='suggest']/lst[@name='free_text_suggest']/lst[@name='foo']/int[@name='numFound'][.='1']", "//lst[@name='suggest']/lst[@name='free_text_suggest']/lst[@name='foo']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='foo']"); assertQ( - req( - "qt", + reqWithPath( URI, "q", "b", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestFuzzyAnalyzedSuggestions.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestFuzzyAnalyzedSuggestions.java index bed48660a555..f2782940a403 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestFuzzyAnalyzedSuggestions.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestFuzzyAnalyzedSuggestions.java @@ -30,63 +30,63 @@ public class TestFuzzyAnalyzedSuggestions extends SolrTestCaseJ4 { public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); // Suggestions text include : change, charge, chance - assertQ(req("qt", URI_DEFAULT, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); - assertQ(req("qt", URI_MIN_EDIT_2, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); - assertQ(req("qt", URI_NON_PREFIX_LENGTH_4, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); - assertQ(req("qt", URI_MIN_FUZZY_LENGTH, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI_DEFAULT, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI_MIN_EDIT_2, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI_NON_PREFIX_LENGTH_4, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI_MIN_FUZZY_LENGTH, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); } public void testDefault() { // tests to demonstrate default maxEdit parameter (value: 1), control for testWithMaxEdit2 assertQ( - req("qt", URI_DEFAULT, "q", "chagn", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_DEFAULT, "q", "chagn", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/int[@name='numFound'][.='2']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[1][.='chance']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[2][.='change']"); assertQ( - req("qt", URI_DEFAULT, "q", "chacn", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_DEFAULT, "q", "chacn", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/int[@name='numFound'][.='2']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[1][.='chance']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[2][.='change']"); assertQ( - req("qt", URI_DEFAULT, "q", "chagr", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_DEFAULT, "q", "chagr", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[1][.='charge']"); // test to demonstrate default nonFuzzyPrefix parameter (value: 1), control for // testWithNonFuzzyPrefix4 assertQ( - req("qt", URI_DEFAULT, "q", "chanr", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_DEFAULT, "q", "chanr", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chanr']/int[@name='numFound'][.='3']"); // test to demonstrate default minFuzzyPrefix parameter (value: 3), control for // testWithMinFuzzyLength2 assertQ( - req("qt", URI_DEFAULT, "q", "cyhnce", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_DEFAULT, "q", "cyhnce", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions'][not(node())]"); } public void testWithMaxEdit2() { assertQ( - req("qt", URI_MIN_EDIT_2, "q", "chagn", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_MIN_EDIT_2, "q", "chagn", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/int[@name='numFound'][.='3']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[1][.='chance']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[2][.='change']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[3][.='charge']"); assertQ( - req("qt", URI_MIN_EDIT_2, "q", "chagr", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_MIN_EDIT_2, "q", "chagr", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/int[@name='numFound'][.='3']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[1][.='chance']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[2][.='change']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[3][.='charge']"); assertQ( - req("qt", URI_MIN_EDIT_2, "q", "chacn", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_MIN_EDIT_2, "q", "chacn", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/int[@name='numFound'][.='3']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[1][.='chance']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[2][.='change']", @@ -97,7 +97,7 @@ public void testWithNonFuzzyPrefix4() { // This test should not match charge, as the nonFuzzyPrefix has been set to 4 assertQ( - req("qt", URI_NON_PREFIX_LENGTH_4, "q", "chanr", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_NON_PREFIX_LENGTH_4, "q", "chanr", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chanr']/int[@name='numFound'][.='2']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chanr']/arr[@name='suggestion']/str[1][.='chance']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chanr']/arr[@name='suggestion']/str[2][.='change']"); @@ -107,7 +107,7 @@ public void testWithMinFuzzyLength2() { // This test should match chance as the minFuzzyLength parameter has been set to 2 assertQ( - req("qt", URI_MIN_FUZZY_LENGTH, "q", "chynce", SpellingParams.SPELLCHECK_COUNT, "3"), + reqWithPath(URI_MIN_FUZZY_LENGTH, "q", "chynce", SpellingParams.SPELLCHECK_COUNT, "3"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chynce']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chynce']/arr[@name='suggestion']/str[1][.='chance']"); } diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestHighFrequencyDictionaryFactory.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestHighFrequencyDictionaryFactory.java index 356a945af499..001cf4fa2f45 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestHighFrequencyDictionaryFactory.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestHighFrequencyDictionaryFactory.java @@ -36,8 +36,7 @@ public static void beforeClass() throws Exception { assertU(commit()); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "", @@ -51,8 +50,7 @@ public void testDefault() { // tests to demonstrate default maxEdit parameter (value: 1), control for testWithMaxEdit2 assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chagn", @@ -71,8 +69,7 @@ public void testDefault() { + "']/lst[@name='chagn']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='change']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chacn", @@ -91,8 +88,7 @@ public void testDefault() { + "']/lst[@name='chacn']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='change']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chagr", @@ -108,8 +104,7 @@ public void testDefault() { + "']/lst[@name='chagr']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='charge']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "chanr", @@ -122,8 +117,7 @@ public void testDefault() { + "']/lst[@name='chanr']/int[@name='numFound'][.='3']"); assertQ( - req( - "qt", + reqWithPath( REQUEST_URI, "q", "cyhnce", diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/TestPhraseSuggestions.java b/solr/core/src/test/org/apache/solr/spelling/suggest/TestPhraseSuggestions.java index f73f2f2407e6..5aa3f9cf5e17 100644 --- a/solr/core/src/test/org/apache/solr/spelling/suggest/TestPhraseSuggestions.java +++ b/solr/core/src/test/org/apache/solr/spelling/suggest/TestPhraseSuggestions.java @@ -26,19 +26,19 @@ public class TestPhraseSuggestions extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { initCore("solrconfig-phrasesuggest.xml", "schema-phrasesuggest.xml"); - assertQ(req("qt", URI, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); + assertQ(reqWithPath(URI, "q", "", SpellingParams.SPELLCHECK_BUILD, "true")); } public void test() { assertQ( - req("qt", URI, "q", "the f", SpellingParams.SPELLCHECK_COUNT, "4"), + reqWithPath(URI, "q", "the f", SpellingParams.SPELLCHECK_COUNT, "4"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='the f']/int[@name='numFound'][.='3']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='the f']/arr[@name='suggestion']/str[1][.='the final phrase']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='the f']/arr[@name='suggestion']/str[2][.='the fifth phrase']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='the f']/arr[@name='suggestion']/str[3][.='the first phrase']"); assertQ( - req("qt", URI, "q", "Testing +12", SpellingParams.SPELLCHECK_COUNT, "4"), + reqWithPath(URI, "q", "Testing +12", SpellingParams.SPELLCHECK_COUNT, "4"), "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='testing 12']/int[@name='numFound'][.='1']", "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='testing 12']/arr[@name='suggestion']/str[1][.='testing 1234']"); } diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java index a589eafdf4c6..a5109562d0d6 100644 --- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java +++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java @@ -357,7 +357,7 @@ public void testUpdatingDocValues() throws Exception { v20, "id", "20", "_version_", v20, "inplace_updatable_float", map("inc", 1)); // RTG before a commit assertJQ( - req("qt", "/get", "id", "20", "fl", "id,inplace_updatable_float,_version_"), + reqWithPath("/get", "id", "20", "fl", "id,inplace_updatable_float,_version_"), "=={'doc':{'id':'20', 'inplace_updatable_float':" + 102.0 + ",'_version_':" + v20 + "}}"); assertU(commit("softCommit", "false")); assertQ( @@ -653,7 +653,7 @@ public void testUpdateTwoDifferentFields() throws Exception { // RTG assertJQ( - req("qt", "/get", "id", "1", "fl", "id,inplace_updatable_float,inplace_updatable_int"), + reqWithPath("/get", "id", "1", "fl", "id,inplace_updatable_float,inplace_updatable_int"), "=={'doc':{'id':'1', 'inplace_updatable_float':" + 202.0 + ",'inplace_updatable_int':" @@ -670,7 +670,7 @@ public void testUpdateWithValueNull() throws Exception { assertQ(req("q", "*:*", "fq", "inplace_updatable_float:[* TO *]"), "//*[@numFound='1']"); // RTG before update assertJQ( - req("qt", "/get", "id", "1", "fl", "id,inplace_updatable_float,title_s"), + reqWithPath("/get", "id", "1", "fl", "id,inplace_updatable_float,title_s"), "=={'doc':{'id':'1', 'inplace_updatable_float':" + 42.0 + ",'title_s':" + "first" + "}}"); // set the value to null @@ -681,7 +681,7 @@ public void testUpdateWithValueNull() throws Exception { assertQ(req("q", "*:*", "fq", "inplace_updatable_float:[* TO *]"), "//*[@numFound='0']"); // after update assertJQ( - req("qt", "/get", "id", "1", "fl", "id,inplace_updatable_float,title_s"), + reqWithPath("/get", "id", "1", "fl", "id,inplace_updatable_float,title_s"), "=={'doc':{'id':'1','title_s':first}}"); } diff --git a/solr/core/src/test/org/apache/solr/update/TestUpdate.java b/solr/core/src/test/org/apache/solr/update/TestUpdate.java index a23e0bad45d5..576fbcee26a2 100644 --- a/solr/core/src/test/org/apache/solr/update/TestUpdate.java +++ b/solr/core/src/test/org/apache/solr/update/TestUpdate.java @@ -61,7 +61,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,*_i,*_is,copyfield_*"), + reqWithPath("/get", "id", "1", "fl", "id,*_i,*_is,copyfield_*"), "=={'doc':{'id':'1', 'val_i':5, 'val_is':[10,5], 'copyfield_source':['a','b']}}" // real-time get should not return stored copyfield targets ); @@ -70,7 +70,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,*_i,*_is"), + reqWithPath("/get", "id", "1", "fl", "id,*_i,*_is"), "=={'doc':{'id':'1', 'val_i':100, 'val_is':[10,5,-1]}}"); // Do a search to get all stored fields back and make sure that the stored copyfield target only @@ -110,7 +110,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,*_i,*_is"), + reqWithPath("/get", "id", "1", "fl", "id,*_i,*_is"), "=={'doc':{'id':'1', 'val_i':100, 'val_is':[10,5,-1,-100,-200]}}"); // extra field should just be treated as a "set" @@ -118,7 +118,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,*_i,*_is"), + reqWithPath("/get", "id", "1", "fl", "id,*_i,*_is"), "=={'doc':{'id':'1', 'val_i':2, 'val_is':[10,5,-1,-100,-200,-300]}}"); // a null value should be treated as "remove" @@ -126,7 +126,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,*_i,*_is"), + reqWithPath("/get", "id", "1", "fl", "id,*_i,*_is"), "=={'doc':{'id':'1', 'val_is':[10,5,-1,-100,-200,-300,-400]}}"); version = deleteAndGetVersion("1", null); @@ -145,7 +145,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { version = addAndGetVersion(sdoc("id", "1", "val_i", 102, "val_is", map("add", -102)), null); afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,val*"), + reqWithPath("/get", "id", "1", "fl", "id,val*"), "=={'doc':{'id':'1', 'val_i':102, 'val_is':[-102]}}"); version = addAndGetVersion(sdoc("id", "1", "val_i", 5), null); @@ -170,7 +170,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,val*"), + reqWithPath("/get", "id", "1", "fl", "id,val*"), "=={'doc':{'id':'1', 'val_i':5, 'val_is':[1], 'val2_i':1, 'val2_f':1.0, 'val2_d':1.0, 'val2_l':1}}"); version = @@ -192,7 +192,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,val*"), + reqWithPath("/get", "id", "1", "fl", "id,val*"), "=={'doc':{'id':'1', 'val_i':5, 'val_is':[-4], 'val2_i':-4, 'val2_f':-4.0, 'val2_d':-4.0, 'val2_l':-4}}"); version = @@ -214,7 +214,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,val*"), + reqWithPath("/get", "id", "1", "fl", "id,val*"), "=={'doc':{'id':'1', 'val_i':5, 'val_is':[1999999996], 'val2_i':-2000000004, 'val2_f':1.0E20, 'val2_d':-1.2345678901e+100, 'val2_l':4999999996}}"); // remove some fields @@ -229,7 +229,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,val*"), + reqWithPath("/get", "id", "1", "fl", "id,val*"), "=={'doc':{'id':'1', 'val_i':5, 'val2_i':-2000000004, 'val2_d':-1.2345678901e+100, 'val2_l':4999999996}}"); // test that updating a unique id results in failure. @@ -248,7 +248,7 @@ public void doUpdateTest(Callable afterUpdate) throws Exception { afterUpdate.call(); assertJQ( - req("qt", "/get", "id", "1", "fl", "id,val*"), + reqWithPath("/get", "id", "1", "fl", "id,val*"), "=={'doc':{'id':'1', 'val_i':5, 'val2_i':-2000000004, 'val2_d':-1.2345678901e+100, 'val2_l':4999999996}}"); // nothing should have changed - check with a normal query that we didn't create a duplicate diff --git a/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java b/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java index c951ad9141cf..d98ce25efa11 100644 --- a/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java +++ b/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java @@ -200,7 +200,7 @@ public void testApplyPartialUpdatesWithDelete() throws Exception { // sanity check that the update log has one document, and RTG returns the document assertEquals(1, ulog.map.size()); assertJQ( - req("qt", "/get", "id", "1"), + reqWithPath("/get", "id", "1"), "=={'doc':{ 'id':'1', 'val1_i_dvo':3, '_version_':102, 'title_s':'title1', " // fields with default values + "'inplace_updatable_int_with_default':666, 'inplace_updatable_float_with_default':42.0}}"); @@ -215,7 +215,7 @@ public void testApplyPartialUpdatesWithDelete() throws Exception { assertTrue(String.valueOf(ulog.prevMap), ulog.prevMap == null || ulog.prevMap.size() == 0); assertTrue(String.valueOf(ulog.prevMap2), ulog.prevMap2 == null || ulog.prevMap2.size() == 0); // verify that the document is deleted, by doing an RTG call - assertJQ(req("qt", "/get", "id", "1"), "=={'doc':null}"); + assertJQ(reqWithPath("/get", "id", "1"), "=={'doc':null}"); } else { // dbi List entry = ((List) ulog.lookup(DOC_1_INDEXED_ID)); assertEquals( diff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java index b953203ca7a5..8d3bda2d749c 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java +++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java @@ -1551,7 +1551,7 @@ public void testFieldsWithDefaultValuesWhenAtomicUpdatesAgainstTlog() { assertU(adoc(sdoc("id", "7", fieldToUpdate, "666"))); assertQ( fieldToUpdate + ": initial RTG", - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/int[@name='" + fieldToUpdate + "'][.='666']", @@ -1565,7 +1565,7 @@ public void testFieldsWithDefaultValuesWhenAtomicUpdatesAgainstTlog() { assertU(adoc(sdoc("id", "7", fieldToUpdate, Map.of("inc", -555)))); assertQ( fieldToUpdate + ": RTG after atomic update", - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/int[@name='" + fieldToUpdate + "'][.='111']", @@ -1578,7 +1578,7 @@ public void testFieldsWithDefaultValuesWhenAtomicUpdatesAgainstTlog() { assertU(commit()); assertQ( fieldToUpdate + ": post commit RTG", - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/int[@name='" + fieldToUpdate + "'][.='111']", @@ -1599,7 +1599,7 @@ public void testAtomicUpdateOfFieldsWithDefaultValue() { assertU(adoc(sdoc("id", "7", fieldToUpdate, Map.of("inc", "666")))); assertQ( fieldToUpdate + ": initial RTG#7", - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/int[@name='" + fieldToUpdate + "'][.='708']", @@ -1612,7 +1612,7 @@ public void testAtomicUpdateOfFieldsWithDefaultValue() { assertU(adoc(sdoc("id", "7", fieldToUpdate, Map.of("inc", -555)))); assertQ( fieldToUpdate + ": RTG#7 after atomic update", - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/int[@name='" + fieldToUpdate + "'][.='153']", @@ -1626,7 +1626,7 @@ public void testAtomicUpdateOfFieldsWithDefaultValue() { assertU(adoc(sdoc("id", "8", fieldToUpdate, Map.of("set", "666")))); assertQ( fieldToUpdate + ": initial RTG#8", - req("qt", "/get", "id", "8"), + reqWithPath("/get", "id", "8"), "count(//doc)=1", "//doc/str[@name='id'][.='8']", "//doc/int[@name='" + fieldToUpdate + "'][.='666']", @@ -1639,7 +1639,7 @@ public void testAtomicUpdateOfFieldsWithDefaultValue() { assertU(adoc(sdoc("id", "8", fieldToUpdate, Map.of("inc", -555)))); assertQ( fieldToUpdate + ": RTG after atomic update", - req("qt", "/get", "id", "8"), + reqWithPath("/get", "id", "8"), "count(//doc)=1", "//doc/str[@name='id'][.='8']", "//doc/int[@name='" + fieldToUpdate + "'][.='111']", @@ -1653,7 +1653,7 @@ public void testAtomicUpdateOfFieldsWithDefaultValue() { assertQ( fieldToUpdate + ": doc7 post commit RTG", - req("qt", "/get", "id", "7"), + reqWithPath("/get", "id", "7"), "count(//doc)=1", "//doc/str[@name='id'][.='7']", "//doc/int[@name='" + fieldToUpdate + "'][.='153']", @@ -1664,7 +1664,7 @@ public void testAtomicUpdateOfFieldsWithDefaultValue() { "//doc/arr[@name='multiDefault']/str[.='muLti-Default']"); assertQ( fieldToUpdate + ": doc8 post commit RTG", - req("qt", "/get", "id", "8"), + reqWithPath("/get", "id", "8"), "count(//doc)=1", "//doc/str[@name='id'][.='8']", "//doc/int[@name='" + fieldToUpdate + "'][.='111']", diff --git a/solr/core/src/test/org/apache/solr/update/processor/NestedAtomicUpdateTest.java b/solr/core/src/test/org/apache/solr/update/processor/NestedAtomicUpdateTest.java index ec4f00775c29..d3f75dbe924a 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/NestedAtomicUpdateTest.java +++ b/solr/core/src/test/org/apache/solr/update/processor/NestedAtomicUpdateTest.java @@ -508,7 +508,7 @@ public void testBlockAtomicAdd() throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, child2, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, child2, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\",\"bbb\"], child2:[{\"id\":\"3\", \"cat_ss\": [\"child\"]}]," + "child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" @@ -521,7 +521,7 @@ public void testBlockAtomicAdd() throws Exception { // this requires ChildDocTransformer to get the whole block, since the document is retrieved // using an index lookup assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, child2, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, child2, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\",\"bbb\"], child2:[{\"id\":\"3\", \"cat_ss\": [\"child\"]}]," + "child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" @@ -538,14 +538,14 @@ public void testBlockAtomicAdd() throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, child2, child3, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, child2, child3, [child]"), "=={'doc':{'id':'1'" + ", cat_ss:[\"aaa\",\"ccc\",\"bbb\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"], child3:[{\"id\":\"4\",\"cat_ss\":[\"grandChild\"]}]}]," + "child2:[{\"id\":\"3\", \"cat_ss\": [\"child\"]}]" + " }}"); assertJQ( - req("qt", "/get", "id", "2", "fl", "id, cat_ss, child, child3, [child]"), + reqWithPath("/get", "id", "2", "fl", "id, cat_ss, child, child3, [child]"), "=={'doc':{\"id\":\"2\",\"cat_ss\":[\"child\"], child3:[{\"id\":\"4\",\"cat_ss\":[\"grandChild\"]}]}" + " }}"); @@ -563,14 +563,14 @@ public void testBlockAtomicAdd() throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, child2, child3, child4, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, child2, child3, child4, [child]"), "=={'doc':{'id':'1'" + ", cat_ss:[\"aaa\",\"ccc\",\"bbb\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"], child3:[{\"id\":\"4\",\"cat_ss\":[\"grandChild\"]," + " child4:[{\"id\":\"5\",\"cat_ss\":[\"greatGrandChild\"]}]}]}], child2:[{\"id\":\"3\", \"cat_ss\": [\"child\"]}]" + " }}"); assertJQ( - req("qt", "/get", "id", "4", "fl", "id, cat_ss, child4, [child]"), + reqWithPath("/get", "id", "4", "fl", "id, cat_ss, child4, [child]"), "=={'doc':{\"id\":\"4\",\"cat_ss\":[\"grandChild\"], child4:[{\"id\":\"5\",\"cat_ss\":[\"greatGrandChild\"]}]}" + " }}"); @@ -590,7 +590,7 @@ public void testBlockAtomicAdd() throws Exception { assertU(commit()); assertJQ( - req("qt", "/get", "id", "4", "fl", "id, cat_ss, child4, [child]"), + reqWithPath("/get", "id", "4", "fl", "id, cat_ss, child4, [child]"), "=={'doc':{\"id\":\"4\",\"cat_ss\":[\"grandChild\"], child4:[{\"id\":\"5\",\"cat_ss\":[\"greatGrandChild\"]}," + "{\"id\":\"6\", \"cat_ss\":[\"greatGrandChild\"]}]}" + " }}"); @@ -668,7 +668,7 @@ public void testBlockAtomicSet() throws Exception { assertJQ(req("q", "id:1"), "/response/numFound==1"); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" + " }}"); @@ -676,7 +676,7 @@ public void testBlockAtomicSet() throws Exception { assertU(commit()); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" + " }}"); @@ -694,7 +694,7 @@ public void testBlockAtomicSet() throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"bbb\"], child1:{\"id\":\"3\",\"cat_ss\":[\"child\"]}" + " }}"); @@ -705,7 +705,7 @@ public void testBlockAtomicSet() throws Exception { // rather than the transaction log. this requires ChildDocTransformer to get the whole block, // since the document is retrieved using an index lookup assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={'doc':{'id':'1'" + ", cat_ss:[\"aaa\",\"bbb\"], child1:{\"id\":\"3\",\"cat_ss\":[\"child\"]}" + " }}"); @@ -715,13 +715,13 @@ public void testBlockAtomicSet() throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, child2, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, child2, [child]"), "=={'doc':{'id':'1'" + ", cat_ss:[\"aaa\",\"bbb\"], child1:{\"id\":\"3\",\"cat_ss\":[\"child\"], child2:{\"id\":\"4\",\"cat_ss\":[\"child\"]}}" + " }}"); assertJQ( - req("qt", "/get", "id", "3", "fl", "id, cat_ss, child, child2, [child]"), + reqWithPath("/get", "id", "3", "fl", "id, cat_ss, child, child2, [child]"), "=={'doc':{\"id\":\"3\",\"cat_ss\":[\"child\"], child2:{\"id\":\"4\",\"cat_ss\":[\"child\"]}}" + " }}"); @@ -811,7 +811,7 @@ public void testBlockAtomicRemove() throws Exception { assertJQ(req("q", "id:1"), "/response/numFound==1"); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}, {\"id\":\"3\",\"cat_ss\":[\"child\"]}]" + " }}"); @@ -819,7 +819,7 @@ public void testBlockAtomicRemove() throws Exception { assertU(commit()); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}, {\"id\":\"3\",\"cat_ss\":[\"child\"]}]" + " }}"); @@ -828,7 +828,7 @@ public void testBlockAtomicRemove() throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" + " }}"); @@ -839,7 +839,7 @@ public void testBlockAtomicRemove() throws Exception { // rather than the transaction log. this requires ChildDocTransformer to get the whole block, // since the document is retrieved using an index lookup assertJQ( - req("qt", "/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, cat_ss, child1, [child]"), "=={'doc':{'id':'1'" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" + " }}"); @@ -905,14 +905,14 @@ private void testBlockAtomicSetToNullOrEmpty(boolean empty) throws Exception { assertJQ(req("q", "id:1"), "/response/numFound==1"); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\", \"latlon\":\"0,0\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}, {\"id\":\"3\",\"cat_ss\":[\"child\"]}]}}"); assertU(commit()); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\", \"latlon\":\"0,0\"" + ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}, {\"id\":\"3\",\"cat_ss\":[\"child\"]}]}}"); @@ -922,7 +922,7 @@ private void testBlockAtomicSetToNullOrEmpty(boolean empty) throws Exception { addAndGetVersion(doc, null); assertJQ( - req("qt", "/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\", \"latlon\":\"0,0\", cat_ss:[\"aaa\",\"ccc\"]}}"); assertU(commit()); @@ -931,7 +931,7 @@ private void testBlockAtomicSetToNullOrEmpty(boolean empty) throws Exception { // rather than the transaction log. this requires ChildDocTransformer to get the whole block, // since the document is retrieved using an index lookup assertJQ( - req("qt", "/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), + reqWithPath("/get", "id", "1", "fl", "id, latlon, cat_ss, child1, [child]"), "=={\"doc\":{'id':\"1\", \"latlon\":\"0,0\", cat_ss:[\"aaa\",\"ccc\"]}}"); // ensure the whole block has been committed correctly to the index. diff --git a/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java b/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java index ca28d1333be2..875176a09dfd 100644 --- a/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java +++ b/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java @@ -60,22 +60,22 @@ public void testSimpleUpdates() throws Exception { assertU(adoc("id", "aaa", "name", "a2", "my_version_l", "1002")); assertU(commit()); assertU(adoc("id", "aaa", "name", "XX", "my_version_l", "1")); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ(req("q", "+id:aaa +name:a2"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); // skip low version against uncommitted data from updateLog assertU(adoc("id", "aaa", "name", "a3", "my_version_l", "1003")); assertU(adoc("id", "aaa", "name", "XX", "my_version_l", "7")); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ(req("q", "+id:aaa +name:a3"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); // interleave updates to multiple docs using same versions for (long ver = 1010; ver < 1020; ver++) { @@ -86,7 +86,7 @@ public void testSimpleUpdates() throws Exception { for (String id : new String[] {"aaa", "bbb", "ccc", "ddd"}) { assertU(adoc("id", id, "name", "XX", "my_version_l", "10")); assertJQ( - req("qt", "/get", "id", id, "fl", "my_version_l"), + reqWithPath("/get", "id", id, "fl", "my_version_l"), "=={'doc':{'my_version_l':" + 1019 + "}}"); } assertU(commit()); @@ -96,7 +96,7 @@ public void testSimpleUpdates() throws Exception { assertJQ(req("q", "+name:XX +id:" + id), "/response/numFound==0"); assertJQ(req("q", "+id:" + id + " +my_version_l:1019"), "/response/numFound==1"); assertJQ( - req("qt", "/get", "id", id, "fl", "my_version_l"), + reqWithPath("/get", "id", id, "fl", "my_version_l"), "=={'doc':{'my_version_l':" + 1019 + "}}"); } } @@ -109,42 +109,42 @@ public void testSimpleDeletes() throws Exception { assertU(adoc("id", "aaa", "name", "a2", "my_version_l", "1002")); assertU(commit()); deleteAndGetVersion("aaa", params("del_version", "7")); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:a2"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); // skip low version delete against uncommitted doc from updateLog assertU(adoc("id", "aaa", "name", "a3", "my_version_l", "1003")); deleteAndGetVersion("aaa", params("del_version", "8")); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:a3"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a3'}}"); // skip low version add against uncommitted "delete" from updateLog deleteAndGetVersion("aaa", params("del_version", "1010")); assertU(adoc("id", "aaa", "name", "XX", "my_version_l", "22")); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); // skip low version add against committed "delete" // (delete was already done & committed above) assertU(adoc("id", "aaa", "name", "XX", "my_version_l", "23")); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); } /** @@ -162,13 +162,13 @@ public void testFloatVersionField() throws Exception { jsonAdd(sdoc("id", "aaa", "name", "XX", "my_version_f", "4.2")), params("update.chain", "external-version-float")); assertU(commit()); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); deleteAndGetVersion( "aaa", params( "del_version", "7", "update.chain", "external-version-float")); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); assertU(commit()); // skip low version delete against uncommitted doc from updateLog @@ -180,11 +180,11 @@ public void testFloatVersionField() throws Exception { params( "del_version", "8", "update.chain", "external-version-float")); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:a2"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); // skip low version add against uncommitted "delete" from updateLog deleteAndGetVersion( @@ -196,12 +196,13 @@ public void testFloatVersionField() throws Exception { jsonAdd(sdoc("id", "aaa", "name", "XX", "my_version_f", "10.05")), params("update.chain", "external-version-float")); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_f"), "=={'doc':{'my_version_f':10.10}}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_f"), + "=={'doc':{'my_version_f':10.10}}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_f"), "=={'doc':{'my_version_f':10.10}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_f"), "=={'doc':{'my_version_f':10.10}}"); // skip low version add against committed "delete" // (delete was already done & committed above) @@ -209,12 +210,13 @@ public void testFloatVersionField() throws Exception { jsonAdd(sdoc("id", "aaa", "name", "XX", "my_version_f", "10.09")), params("update.chain", "external-version-float")); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_f"), "=={'doc':{'my_version_f':10.10}}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_f"), + "=={'doc':{'my_version_f':10.10}}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_f"), "=={'doc':{'my_version_f':10.10}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_f"), "=={'doc':{'my_version_f':10.10}}"); } public void testFailOnOldVersion() throws Exception { @@ -236,7 +238,7 @@ public void testFailOnOldVersion() throws Exception { assertEquals(409, ex.code()); assertU(commit()); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); ex = expectThrows( @@ -247,7 +249,7 @@ public void testFailOnOldVersion() throws Exception { }); assertEquals(409, ex.code()); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a1'}}"); assertU(commit()); // fail low version delete against uncommitted doc from updateLog @@ -263,11 +265,11 @@ public void testFailOnOldVersion() throws Exception { }); assertEquals(409, ex.code()); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:a2"), "/response/numFound==1"); - assertJQ(req("qt", "/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); + assertJQ(reqWithPath("/get", "id", "aaa", "fl", "name"), "=={'doc':{'name':'a2'}}"); // fail low version add against uncommitted "delete" from updateLog deleteAndGetVersion( @@ -286,12 +288,12 @@ public void testFailOnOldVersion() throws Exception { assertEquals(409, ex.code()); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); // fail low version add against committed "delete" // (delete was already done & committed above) @@ -306,12 +308,12 @@ public void testFailOnOldVersion() throws Exception { assertEquals(409, ex.code()); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}}"); assertU(commit()); assertJQ(req("q", "+id:aaa"), "/response/numFound==1"); assertJQ(req("q", "+id:aaa +name:XX"), "/response/numFound==0"); assertJQ( - req("qt", "/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); + reqWithPath("/get", "id", "aaa", "fl", "my_version_l"), "=={'doc':{'my_version_l':1010}}"); } // Test multiple versions, that it has to be greater than my_version_l and my_version_f @@ -589,7 +591,7 @@ public void testConcurrentAdds() throws Exception { + (!winnerIsDeleted ? ",'name':'name" + id + "_" + winner + "'}" : "}"); assertJQ( - req("qt", "/get", "id", "" + id, "fl", "id,name,my_version_l"), + reqWithPath("/get", "id", "" + id, "fl", "id,name,my_version_l"), "=={'doc':" + expectedDoc + "}"); assertU(commit()); assertJQ( @@ -638,10 +640,10 @@ public void testMissingVersionOnOldDocs() throws Exception { assertU(commit()); assertJQ(req("q", "*:*"), "/response/numFound==2"); assertJQ( - req("qt", "/get", "id", "a", "fl", "id,my_version_l"), + reqWithPath("/get", "id", "a", "fl", "id,my_version_l"), "=={'doc':{'id':'a', 'my_version_l':3}}"); // version changed to 3 assertJQ( - req("qt", "/get", "id", "b", "fl", "id,my_version_l"), + reqWithPath("/get", "id", "b", "fl", "id,my_version_l"), "=={'doc':{'id':'b'}}"); // no version, because update failed // Try to update again using the external version enforcement, but allowing old docs to not have @@ -657,10 +659,10 @@ public void testMissingVersionOnOldDocs() throws Exception { assertU(commit()); assertJQ(req("q", "*:*"), "/response/numFound==2"); assertJQ( - req("qt", "/get", "id", "a", "fl", "id,my_version_l"), + reqWithPath("/get", "id", "a", "fl", "id,my_version_l"), "=={'doc':{'id':'a', 'my_version_l':3}}"); assertJQ( - req("qt", "/get", "id", "b", "fl", "id,my_version_l"), + reqWithPath("/get", "id", "b", "fl", "id,my_version_l"), "=={'doc':{'id':'b', 'my_version_l':1}}"); }