Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-5987: Add "collection" to UpdateParams.

Mark Robert Millerb0cdbe224293
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b3cbd0670ce..36467f5f8c1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -113,6 +113,7 @@ Other Changes
* SOLR-5474: Have a new mode for SolrJ to support stateFormat=2 (Noble Paul, Tim Potter)
+* SOLR-5987: Add "collection" to UpdateParams. (Mark Miller, Greg Solovyev)
================== 4.8.0 ==================
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
index 7d549968675..34617a0698d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
@@ -332,7 +332,7 @@ public class CloudSolrServer extends SolrServer {
}
}
- String collection = nonRoutableParams.get("collection", defaultCollection);
+ String collection = nonRoutableParams.get(UpdateParams.COLLECTION, defaultCollection);
if (collection == null) {
throw new SolrServerException("No collection param specified on request and no default collection has been set.");
}
@@ -721,7 +721,7 @@ public class CloudSolrServer extends SolrServer {
theUrlList.add(zkStateReader.getBaseUrlForNodeName(liveNode));
}
} else {
- String collection = reqParams.get("collection", defaultCollection);
+ String collection = reqParams.get(UpdateParams.COLLECTION, defaultCollection);
if (collection == null) {
throw new SolrServerException(
@@ -771,7 +771,7 @@ public class CloudSolrServer extends SolrServer {
if (nodes.put(node, nodeProps) == null) {
if (!sendToLeaders || (sendToLeaders && coreNodeProps.isLeader())) {
String url;
- if (reqParams.get("collection") == null) {
+ if (reqParams.get(UpdateParams.COLLECTION) == null) {
url = ZkCoreNodeProps.getCoreUrl(
nodeProps.getStr(ZkStateReader.BASE_URL_PROP),
defaultCollection);
@@ -781,7 +781,7 @@ public class CloudSolrServer extends SolrServer {
urlList2.add(url);
} else if (sendToLeaders) {
String url;
- if (reqParams.get("collection") == null) {
+ if (reqParams.get(UpdateParams.COLLECTION) == null) {
url = ZkCoreNodeProps.getCoreUrl(
nodeProps.getStr(ZkStateReader.BASE_URL_PROP),
defaultCollection);
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java b/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
index 8d11fc6af0d..cf965a91df1 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
@@ -52,6 +52,8 @@ public interface UpdateParams
/** Rollback update commands */
public static String ROLLBACK = "rollback";
+ public static String COLLECTION = "collection";
+
/** Select the update processor chain to use. A RequestHandler may or may not respect this parameter */
public static final String UPDATE_CHAIN = "update.chain";