Apache Solr open-source search software
SolrJ V2Request.getCollection broken (#125)
David Smileyf01c41361f69
diff --git a/solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java b/solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.javaindex 6fc1a8e1d9f..9b33bffcdce 100644--- a/solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java@@ -160,8 +160,10 @@ public class V2ApiIntegrationTest extends SolrCloudTestCase {@Testpublic void testCollectionsApi() throws Exception {CloudSolrClient client = cluster.getSolrClient();+ V2Request req1 = new V2Request.Builder("/c/" + COLL_NAME + "/get/_introspect").build();+ assertEquals(COLL_NAME, req1.getCollection());@SuppressWarnings({"rawtypes"})- Map result = resAsMap(client, new V2Request.Builder("/c/"+COLL_NAME+"/get/_introspect").build());+ Map result = resAsMap(client, req1);assertEquals("/c/collection1/get", Utils.getObjectByPath(result, true, "/spec[0]/url/paths[0]"));result = resAsMap(client, new V2Request.Builder("/collections/"+COLL_NAME+"/get/_introspect").build());assertEquals("/collections/collection1/get", Utils.getObjectByPath(result, true, "/spec[0]/url/paths[0]"));diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/V2Request.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/V2Request.javaindex fda9ed337d6..f3451efc2f3 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/V2Request.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/V2Request.java@@ -41,7 +41,7 @@ import static org.apache.solr.common.params.CommonParams.JSON_MIME;public class V2Request extends SolrRequest<V2Response> implements MapWriter {//only for debugging purposespublic static final ThreadLocal<AtomicLong> v2Calls = new ThreadLocal<>();- static final Pattern COLL_REQ_PATTERN = Pattern.compile("/(c|collections)/([^/])+/(?!shards)");+ static final Pattern COLL_REQ_PATTERN = Pattern.compile("/(c|collections)/([^/]+)/(?!shards)");private Object payload;private SolrParams solrParams;public final boolean useBinary;