From b0cdbe224293f02282e2e19c25476c3b90701120 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Wed, 16 Apr 2014 14:24:48 +0000 Subject: [PATCH] SOLR-5987: Add "collection" to UpdateParams. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1587918 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 1 + .../apache/solr/client/solrj/impl/CloudSolrServer.java | 8 ++++---- .../java/org/apache/solr/common/params/UpdateParams.java | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) 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";