lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject lucene-solr:branch_7x: SOLR-11914: Deprecated some SolrParams methods. * toSolrParams(nl) moved to a NamedList method, which is more natural.
Date Mon, 23 Apr 2018 17:27:31 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 9a3a43771 -> 9e36c51e6


SOLR-11914: Deprecated some SolrParams methods.
* toSolrParams(nl) moved to a NamedList method, which is more natural.

(cherry picked from commit 1409ab8)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9e36c51e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9e36c51e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9e36c51e

Branch: refs/heads/branch_7x
Commit: 9e36c51e6575a8d750ddc62683c528df197f2833
Parents: 9a3a437
Author: David Smiley <dsmiley@apache.org>
Authored: Mon Apr 23 13:26:49 2018 -0400
Committer: David Smiley <dsmiley@apache.org>
Committed: Mon Apr 23 13:27:26 2018 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                |   4 +
 .../carrot2/CarrotClusteringEngine.java         |   2 +-
 ...anguageIdentifierUpdateProcessorFactory.java |   8 +-
 ...OpenNLPLangDetectUpdateProcessorFactory.java |   8 +-
 ...anguageIdentifierUpdateProcessorFactory.java |   8 +-
 .../apache/solr/core/HdfsDirectoryFactory.java  |  13 +-
 .../apache/solr/core/MMapDirectoryFactory.java  |   2 +-
 .../solr/core/NRTCachingDirectoryFactory.java   |   2 +-
 .../src/java/org/apache/solr/core/SolrCore.java |  24 +++-
 .../apache/solr/handler/CdcrRequestHandler.java |   8 +-
 .../apache/solr/handler/RequestHandlerBase.java |   4 +-
 .../solr/handler/UpdateRequestHandler.java      |   2 +-
 .../solr/handler/admin/CollectionsHandler.java  | 142 ++++++++++---------
 .../solr/handler/admin/ConfigSetsHandler.java   |  18 +--
 .../handler/admin/MetricsCollectorHandler.java  |   2 +-
 .../component/QueryElevationComponent.java      |   2 +-
 .../solr/highlight/HighlightingPluginBase.java  |   2 +-
 .../solr/request/LocalSolrQueryRequest.java     |  10 +-
 .../solr/response/XSLTResponseWriter.java       |   2 +-
 .../org/apache/solr/schema/IndexSchema.java     |   2 +-
 .../solr/schema/ManagedIndexSchemaFactory.java  |   2 +-
 .../solr/spelling/DirectSolrSpellChecker.java   |   2 +-
 .../ClassificationUpdateProcessorFactory.java   |   2 +-
 ...oreCommitOptimizeUpdateProcessorFactory.java |   2 +-
 .../processor/LogUpdateProcessorFactory.java    |   2 +-
 .../processor/RegexpBoostProcessorFactory.java  |   2 +-
 .../SignatureUpdateProcessorFactory.java        |   2 +-
 .../processor/URLClassifyProcessorFactory.java  |   2 +-
 .../org/apache/solr/BasicFunctionalityTest.java |   2 +-
 .../solr/handler/admin/TestCollectionAPIs.java  |  23 +++
 .../solrj/io/graph/GatherNodesStream.java       |  20 +--
 .../client/solrj/io/stream/FacetStream.java     |   6 +-
 .../solr/client/solrj/io/stream/SqlStream.java  |   3 +-
 .../solrj/io/stream/TimeSeriesStream.java       |   4 +-
 .../request/JavaBinUpdateRequestCodec.java      |   6 +-
 .../java/org/apache/solr/common/MapWriter.java  |   9 +-
 .../apache/solr/common/params/SolrParams.java   |  22 ++-
 .../org/apache/solr/common/util/NamedList.java  |  30 ++++
 .../solr/common/params/SolrParamTest.java       |  38 +----
 39 files changed, 260 insertions(+), 184 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5873738..5513a5f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -229,6 +229,10 @@ Other Changes
 
 * SOLR-12252: Fix minor compiler and intellij warnings in autoscaling policy framework. (shalin)
 
+* SOLR-11914: The following SolrParams methods are now deprecated: toSolrParams (use NamedList.toSolrParams instead),
+  toMap, toMultiMap, toFilteredSolrParams, getAll.  The latter ones have no direct replacement but are easy to
+  implement yourself as-needed. (David Smiley)
+
 ==================  7.3.1 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java
----------------------------------------------------------------------
diff --git a/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java b/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java
index 33cbb64..4c28916 100644
--- a/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java
+++ b/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/CarrotClusteringEngine.java
@@ -123,7 +123,7 @@ public class CarrotClusteringEngine extends SearchClusteringEngine {
     this.core = core;
 
     String result = super.init(config, core);
-    final SolrParams initParams = SolrParams.toSolrParams(config);
+    final SolrParams initParams = config.toSolrParams();
 
     // Initialization attributes for Carrot2 controller.
     HashMap<String, Object> initAttributes = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java b/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java
index 59663ce..a140807 100644
--- a/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java
+++ b/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java
@@ -82,17 +82,17 @@ public class LangDetectLanguageIdentifierUpdateProcessorFactory extends
       Object o;
       o = args.get("defaults");
       if (o != null && o instanceof NamedList) {
-        defaults = SolrParams.toSolrParams((NamedList) o);
+        defaults = ((NamedList) o).toSolrParams();
       } else {
-        defaults = SolrParams.toSolrParams(args);
+        defaults = args.toSolrParams();
       }
       o = args.get("appends");
       if (o != null && o instanceof NamedList) {
-        appends = SolrParams.toSolrParams((NamedList) o);
+        appends = ((NamedList) o).toSolrParams();
       }
       o = args.get("invariants");
       if (o != null && o instanceof NamedList) {
-        invariants = SolrParams.toSolrParams((NamedList) o);
+        invariants = ((NamedList) o).toSolrParams();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/contrib/langid/src/java/org/apache/solr/update/processor/OpenNLPLangDetectUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/contrib/langid/src/java/org/apache/solr/update/processor/OpenNLPLangDetectUpdateProcessorFactory.java b/solr/contrib/langid/src/java/org/apache/solr/update/processor/OpenNLPLangDetectUpdateProcessorFactory.java
index dfbdcbd..ffe11aa 100644
--- a/solr/contrib/langid/src/java/org/apache/solr/update/processor/OpenNLPLangDetectUpdateProcessorFactory.java
+++ b/solr/contrib/langid/src/java/org/apache/solr/update/processor/OpenNLPLangDetectUpdateProcessorFactory.java
@@ -65,17 +65,17 @@ public class OpenNLPLangDetectUpdateProcessorFactory extends UpdateRequestProces
       Object o;
       o = args.get("defaults");
       if (o != null && o instanceof NamedList) {
-        defaults = SolrParams.toSolrParams((NamedList) o);
+        defaults = ((NamedList) o).toSolrParams();
       } else {
-        defaults = SolrParams.toSolrParams(args);
+        defaults = args.toSolrParams();
       }
       o = args.get("appends");
       if (o != null && o instanceof NamedList) {
-        appends = SolrParams.toSolrParams((NamedList) o);
+        appends = ((NamedList) o).toSolrParams();
       }
       o = args.get("invariants");
       if (o != null && o instanceof NamedList) {
-        invariants = SolrParams.toSolrParams((NamedList) o);
+        invariants = ((NamedList) o).toSolrParams();
       }
 
       // Look for model filename in invariants, then in args, then defaults

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java b/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java
index 5d5acd1..838311b 100644
--- a/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java
+++ b/solr/contrib/langid/src/java/org/apache/solr/update/processor/TikaLanguageIdentifierUpdateProcessorFactory.java
@@ -65,17 +65,17 @@ public class TikaLanguageIdentifierUpdateProcessorFactory extends
       Object o;
       o = args.get("defaults");
       if (o != null && o instanceof NamedList) {
-        defaults = SolrParams.toSolrParams((NamedList) o);
+        defaults = ((NamedList) o).toSolrParams();
       } else {
-        defaults = SolrParams.toSolrParams(args);
+        defaults = args.toSolrParams();
       }
       o = args.get("appends");
       if (o != null && o instanceof NamedList) {
-        appends = SolrParams.toSolrParams((NamedList) o);
+        appends = ((NamedList) o).toSolrParams();
       }
       o = args.get("invariants");
       if (o != null && o instanceof NamedList) {
-        invariants = SolrParams.toSolrParams((NamedList) o);
+        invariants = ((NamedList) o).toSolrParams();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
index e4b06b7..d17d3d6 100644
--- a/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
@@ -16,8 +16,6 @@
  */
 package org.apache.solr.core;
 
-import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION;
-
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.invoke.MethodHandles;
@@ -31,6 +29,10 @@ import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.FileStatus;
@@ -67,10 +69,7 @@ import org.apache.solr.util.plugin.SolrCoreAware;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION;
 
 public class HdfsDirectoryFactory extends CachingDirectoryFactory implements SolrCoreAware, SolrMetricProducer {
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -151,7 +150,7 @@ public class HdfsDirectoryFactory extends CachingDirectoryFactory implements Sol
   @Override
   public void init(NamedList args) {
     super.init(args);
-    params = SolrParams.toSolrParams(args);
+    params = args.toSolrParams();
     this.hdfsDataDir = getConfig(HDFS_HOME, null);
     if (this.hdfsDataDir != null && this.hdfsDataDir.length() == 0) {
       this.hdfsDataDir = null;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
index e9fbce7..0c1875b 100644
--- a/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
@@ -49,7 +49,7 @@ public class MMapDirectoryFactory extends StandardDirectoryFactory {
   @Override
   public void init(NamedList args) {
     super.init(args);
-    SolrParams params = SolrParams.toSolrParams( args );
+    SolrParams params = args.toSolrParams();
     maxChunk = params.getInt("maxChunkSize", MMapDirectory.DEFAULT_MAX_CHUNK_SIZE);
     if (maxChunk <= 0){
       throw new IllegalArgumentException("maxChunk must be greater than 0");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
index 4ecc44c..789ffdb 100644
--- a/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
@@ -38,7 +38,7 @@ public class NRTCachingDirectoryFactory extends StandardDirectoryFactory {
   @Override
   public void init(NamedList args) {
     super.init(args);
-    SolrParams params = SolrParams.toSolrParams(args);
+    SolrParams params = args.toSolrParams();
     maxMergeSizeMB = params.getDouble("maxMergeSizeMB", DEFAULT_MAX_MERGE_SIZE_MB);
     if (maxMergeSizeMB <= 0){
       throw new IllegalArgumentException("maxMergeSizeMB must be greater than 0");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/core/SolrCore.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 83dd2df..7cf264b 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -38,6 +38,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -59,6 +60,7 @@ import java.util.concurrent.locks.ReentrantLock;
 import com.codahale.metrics.Counter;
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.Timer;
+import com.google.common.collect.Iterators;
 import com.google.common.collect.MapMaker;
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.analysis.util.ResourceLoader;
@@ -2540,7 +2542,27 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
     if (lpList == null) {
       toLog.add("params", "{" + req.getParamString() + "}");
     } else if (lpList.length() > 0) {
-      toLog.add("params", "{" + params.toFilteredSolrParams(Arrays.asList(lpList.split(","))).toString() + "}");
+
+      // Filter params by those in LOG_PARAMS_LIST so that we can then call toString
+      HashSet<String> lpSet = new HashSet<>(Arrays.asList(lpList.split(",")));
+      SolrParams filteredParams = new SolrParams() {
+        @Override
+        public Iterator<String> getParameterNamesIterator() {
+          return Iterators.filter(params.getParameterNamesIterator(), lpSet::contains);
+        }
+
+        @Override
+        public String get(String param) { // assume param is in lpSet
+          return params.get(param);
+        } //assume in lpSet
+
+        @Override
+        public String[] getParams(String param) { // assume param is in lpSet
+          return params.getParams(param);
+        } // assume in lpSet
+      };
+
+      toLog.add("params", "{" + filteredParams + "}");
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java
index 430237e..1453841 100644
--- a/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java
@@ -134,19 +134,19 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw
       // Configuration of the Update Log Synchronizer
       Object updateLogSynchonizerParam = args.get(CdcrParams.UPDATE_LOG_SYNCHRONIZER_PARAM);
       if (updateLogSynchonizerParam != null && updateLogSynchonizerParam instanceof NamedList) {
-        updateLogSynchronizerConfiguration = SolrParams.toSolrParams((NamedList) updateLogSynchonizerParam);
+        updateLogSynchronizerConfiguration = ((NamedList) updateLogSynchonizerParam).toSolrParams();
       }
 
       // Configuration of the Replicator
       Object replicatorParam = args.get(CdcrParams.REPLICATOR_PARAM);
       if (replicatorParam != null && replicatorParam instanceof NamedList) {
-        replicatorConfiguration = SolrParams.toSolrParams((NamedList) replicatorParam);
+        replicatorConfiguration = ((NamedList) replicatorParam).toSolrParams();
       }
 
       // Configuration of the Buffer
       Object bufferParam = args.get(CdcrParams.BUFFER_PARAM);
       if (bufferParam != null && bufferParam instanceof NamedList) {
-        bufferConfiguration = SolrParams.toSolrParams((NamedList) bufferParam);
+        bufferConfiguration = ((NamedList) bufferParam).toSolrParams();
       }
 
       // Configuration of the Replicas
@@ -154,7 +154,7 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw
       List replicas = args.getAll(CdcrParams.REPLICA_PARAM);
       for (Object replica : replicas) {
         if (replica != null && replica instanceof NamedList) {
-          SolrParams params = SolrParams.toSolrParams((NamedList) replica);
+          SolrParams params = ((NamedList) replica).toSolrParams();
           if (!replicasConfiguration.containsKey(params.get(CdcrParams.SOURCE_COLLECTION_PARAM))) {
             replicasConfiguration.put(params.get(CdcrParams.SOURCE_COLLECTION_PARAM), new ArrayList<>());
           }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
index d4cfd99..28b91e7 100644
--- a/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
+++ b/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
@@ -124,7 +124,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
    * @see #handleRequest(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)
    * @see #handleRequestBody(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)
    * @see org.apache.solr.util.SolrPluginUtils#setDefaults(org.apache.solr.request.SolrQueryRequest, org.apache.solr.common.params.SolrParams, org.apache.solr.common.params.SolrParams, org.apache.solr.common.params.SolrParams)
-   * @see SolrParams#toSolrParams(org.apache.solr.common.util.NamedList)
+   * @see NamedList#toSolrParams()
    *
    * See also the example solrconfig.xml located in the Solr codebase (example/solr/conf).
    */
@@ -166,7 +166,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
   public static SolrParams getSolrParamsFromNamedList(NamedList args, String key) {
     Object o = args.get(key);
     if (o != null && o instanceof NamedList) {
-      return  SolrParams.toSolrParams((NamedList) o);
+      return ((NamedList) o).toSolrParams();
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java
index fd7a754..3c7ffda 100644
--- a/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/UpdateRequestHandler.java
@@ -136,7 +136,7 @@ public class UpdateRequestHandler extends ContentStreamHandlerBase implements Pe
   protected Map<String,ContentStreamLoader> createDefaultLoaders(NamedList args) {
     SolrParams p = null;
     if(args!=null) {
-      p = SolrParams.toSolrParams(args);
+      p = args.toSolrParams();
     }
     Map<String,ContentStreamLoader> registry = new HashMap<>();
     registry.put("application/xml", new XMLLoader().init(p) );

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
index c02271e..ff47c8b 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
@@ -22,6 +22,7 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -30,7 +31,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
-import java.util.function.BiConsumer;
 import java.util.stream.Collectors;
 
 import com.google.common.collect.ImmutableSet;
@@ -449,9 +449,9 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
      * as well as specific replicas= options
      */
     CREATE_OP(CREATE, (req, rsp, h) -> {
-      Map<String, Object> props = req.getParams().required().getAll(null, NAME);
+      Map<String, Object> props = copy(req.getParams().required(), null, NAME);
       props.put("fromApi", "true");
-      req.getParams().getAll(props,
+      copy(req.getParams(), props,
           REPLICATION_FACTOR,
           COLL_CONF,
           NUM_SLICES,
@@ -491,9 +491,9 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return copyPropertiesWithPrefix(req.getParams(), props, "router.");
 
     }),
-    DELETE_OP(DELETE, (req, rsp, h) -> req.getParams().required().getAll(null, NAME)),
+    DELETE_OP(DELETE, (req, rsp, h) -> copy(req.getParams().required(), null, NAME)),
 
-    RELOAD_OP(RELOAD, (req, rsp, h) -> req.getParams().required().getAll(null, NAME)),
+    RELOAD_OP(RELOAD, (req, rsp, h) -> copy(req.getParams().required(), null, NAME)),
 
     SYNCSHARD_OP(SYNCSHARD, (req, rsp, h) -> {
       String collection = req.getParams().required().get("collection");
@@ -522,35 +522,37 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       String alias = req.getParams().get(NAME);
       SolrIdentifierValidator.validateAliasName(alias);
       String collections = req.getParams().get("collections");
-      Map<String, Object> result = req.getParams().getAll(null, REQUIRED_ROUTER_PARAMS);
-      req.getParams().getAll(result, OPTIONAL_ROUTER_PARAMS);
+      Map<String, Object> result = copy(req.getParams(), null, REQUIRED_ROUTER_PARAMS);
+      copy(req.getParams(), result, OPTIONAL_ROUTER_PARAMS);
       if (collections != null) {
         if (result.size() > 1) { // (NAME should be there, and if it's not we will fail below)
           throw new SolrException(BAD_REQUEST, "Collections cannot be specified when creating a time routed alias.");
         }
         // regular alias creation...
-        return req.getParams().required().getAll(null, NAME, "collections");
+        return copy(req.getParams().required(), null, NAME, "collections");
       }
 
       // Ok so we are creating a time routed alias from here
 
       // for validation....
-      req.getParams().required().getAll(null, REQUIRED_ROUTER_PARAMS);
+      copy(req.getParams().required(), null, REQUIRED_ROUTER_PARAMS);
       ModifiableSolrParams createCollParams = new ModifiableSolrParams(); // without prefix
 
       // add to result params that start with "create-collection.".
       //   Additionally, save these without the prefix to createCollParams
-      forEach(req.getParams(), (p, v) -> {
-          if (p.startsWith(CREATE_COLLECTION_PREFIX)) {
-            // This is what SolrParams#getAll(Map, Collection)} does
-            if (v.length == 1) {
-              result.put(p, v[0]);
-            } else {
-              result.put(p, v);
-            }
-            createCollParams.set(p.substring(CREATE_COLLECTION_PREFIX.length()), v);
+      for (Map.Entry<String, String[]> entry : req.getParams()) {
+        final String p = entry.getKey();
+        if (p.startsWith(CREATE_COLLECTION_PREFIX)) {
+          // This is what SolrParams#getAll(Map, Collection)} does
+          final String[] v = entry.getValue();
+          if (v.length == 1) {
+            result.put(p, v[0]);
+          } else {
+            result.put(p, v);
           }
-        });
+          createCollParams.set(p.substring(CREATE_COLLECTION_PREFIX.length()), v);
+        }
+      }
 
       // Verify that the create-collection prefix'ed params appear to be valid.
       if (createCollParams.get(NAME) != null) {
@@ -568,13 +570,13 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return result;
     }),
 
-    DELETEALIAS_OP(DELETEALIAS, (req, rsp, h) -> req.getParams().required().getAll(null, NAME)),
+    DELETEALIAS_OP(DELETEALIAS, (req, rsp, h) -> copy(req.getParams().required(), null, NAME)),
 
     /**
      * Change properties for an alias (use CREATEALIAS_OP to change the actual value of the alias)
      */
     ALIASPROP_OP(ALIASPROP, (req, rsp, h) -> {
-      Map<String, Object> params = req.getParams().required().getAll(null, NAME);
+      Map<String, Object> params = copy(req.getParams().required(), null, NAME);
 
       // Note: success/no-op in the event of no properties supplied is intentional. Keeps code simple and one less case
       // for api-callers to check for.
@@ -621,7 +623,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
             "Only one of 'ranges' or 'split.key' should be specified");
       }
 
-      Map<String, Object> map = req.getParams().getAll(null,
+      Map<String, Object> map = copy(req.getParams(), null,
           COLLECTION_PROP,
           SHARD_ID_PROP,
           "split.key",
@@ -630,10 +632,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return copyPropertiesWithPrefix(req.getParams(), map, COLL_PROP_PREFIX);
     }),
     DELETESHARD_OP(DELETESHARD, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP,
           SHARD_ID_PROP);
-      req.getParams().getAll(map,
+      copy(req.getParams(), map,
           DELETE_INDEX,
           DELETE_DATA_DIR,
           DELETE_INSTANCE_DIR);
@@ -644,24 +646,24 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return null;
     }),
     CREATESHARD_OP(CREATESHARD, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP,
           SHARD_ID_PROP);
       ClusterState clusterState = h.coreContainer.getZkController().getClusterState();
       final String newShardName = SolrIdentifierValidator.validateShardName(req.getParams().get(SHARD_ID_PROP));
       if (!ImplicitDocRouter.NAME.equals(((Map) clusterState.getCollection(req.getParams().get(COLLECTION_PROP)).get(DOC_ROUTER)).get(NAME)))
         throw new SolrException(ErrorCode.BAD_REQUEST, "shards can be added only to 'implicit' collections");
-      req.getParams().getAll(map,
+      copy(req.getParams(), map,
           REPLICATION_FACTOR,
           CREATE_NODE_SET,
           WAIT_FOR_FINAL_STATE);
       return copyPropertiesWithPrefix(req.getParams(), map, COLL_PROP_PREFIX);
     }),
     DELETEREPLICA_OP(DELETEREPLICA, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP);
 
-      return req.getParams().getAll(map,
+      return copy(req.getParams(), map,
           DELETE_INDEX,
           DELETE_DATA_DIR,
           DELETE_INSTANCE_DIR,
@@ -670,17 +672,17 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
           ONLY_IF_DOWN);
     }),
     MIGRATE_OP(MIGRATE, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null, COLLECTION_PROP, "split.key", "target.collection");
-      return req.getParams().getAll(map, "forward.timeout");
+      Map<String, Object> map = copy(req.getParams().required(), null, COLLECTION_PROP, "split.key", "target.collection");
+      return copy(req.getParams(), map, "forward.timeout");
     }),
     ADDROLE_OP(ADDROLE, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null, "role", "node");
+      Map<String, Object> map = copy(req.getParams().required(), null, "role", "node");
       if (!KNOWN_ROLES.contains(map.get("role")))
         throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown role. Supported roles are ," + KNOWN_ROLES);
       return map;
     }),
     REMOVEROLE_OP(REMOVEROLE, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null, "role", "node");
+      Map<String, Object> map = copy(req.getParams().required(), null, "role", "node");
       if (!KNOWN_ROLES.contains(map.get("role")))
         throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown role. Supported roles are ," + KNOWN_ROLES);
       return map;
@@ -776,7 +778,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       }
     }),
     ADDREPLICA_OP(ADDREPLICA, (req, rsp, h) -> {
-      Map<String, Object> props = req.getParams().getAll(null,
+      Map<String, Object> props = copy(req.getParams(), null,
           COLLECTION_PROP,
           "node",
           SHARD_ID_PROP,
@@ -809,7 +811,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
      * Can return status per specific collection/shard or per all collections.
      */
     CLUSTERSTATUS_OP(CLUSTERSTATUS, (req, rsp, h) -> {
-      Map<String, Object> all = req.getParams().getAll(null,
+      Map<String, Object> all = copy(req.getParams(), null,
           COLLECTION_PROP,
           SHARD_ID_PROP,
           _ROUTE_);
@@ -818,16 +820,16 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return null;
     }),
     UTILIZENODE_OP(UTILIZENODE, (req, rsp, h) -> {
-      return req.getParams().required().getAll(null, AutoScalingParams.NODE);
+      return copy(req.getParams().required(), null, AutoScalingParams.NODE);
     }),
     ADDREPLICAPROP_OP(ADDREPLICAPROP, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP,
           PROPERTY_PROP,
           SHARD_ID_PROP,
           REPLICA_PROP,
           PROPERTY_VALUE_PROP);
-      req.getParams().getAll(map, SHARD_UNIQUE);
+      copy(req.getParams(), map, SHARD_UNIQUE);
       String property = (String) map.get(PROPERTY_PROP);
       if (!property.startsWith(COLL_PROP_PREFIX)) {
         property = COLL_PROP_PREFIX + property;
@@ -848,15 +850,15 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return map;
     }),
     DELETEREPLICAPROP_OP(DELETEREPLICAPROP, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP,
           PROPERTY_PROP,
           SHARD_ID_PROP,
           REPLICA_PROP);
-      return req.getParams().getAll(map, PROPERTY_PROP);
+      return copy(req.getParams(), map, PROPERTY_PROP);
     }),
     BALANCESHARDUNIQUE_OP(BALANCESHARDUNIQUE, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP,
           PROPERTY_PROP);
       Boolean shardUnique = Boolean.parseBoolean(req.getParams().get(SHARD_UNIQUE));
@@ -871,24 +873,24 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
             " Property: " + prop + " shardUnique: " + Boolean.toString(shardUnique));
       }
 
-      return req.getParams().getAll(map, ONLY_ACTIVE_NODES, SHARD_UNIQUE);
+      return copy(req.getParams(), map, ONLY_ACTIVE_NODES, SHARD_UNIQUE);
     }),
     REBALANCELEADERS_OP(REBALANCELEADERS, (req, rsp, h) -> {
       new RebalanceLeaders(req, rsp, h).execute();
       return null;
     }),
     MODIFYCOLLECTION_OP(MODIFYCOLLECTION, (req, rsp, h) -> {
-      Map<String, Object> m = req.getParams().getAll(null, MODIFIABLE_COLL_PROPS);
+      Map<String, Object> m = copy(req.getParams(), null, MODIFIABLE_COLL_PROPS);
       if (m.isEmpty()) throw new SolrException(ErrorCode.BAD_REQUEST,
           formatString("no supported values provided rule, snitch, maxShardsPerNode, replicationFactor, collection.configName"));
-      req.getParams().required().getAll(m, COLLECTION_PROP);
+      copy(req.getParams().required(), m, COLLECTION_PROP);
       addMapObject(m, RULE);
       addMapObject(m, SNITCH);
       for (String prop : MODIFIABLE_COLL_PROPS) DocCollection.verifyProp(m, prop);
       verifyRuleParams(h.coreContainer, m);
       return m;
     }),
-    MIGRATESTATEFORMAT_OP(MIGRATESTATEFORMAT, (req, rsp, h) -> req.getParams().required().getAll(null, COLLECTION_PROP)),
+    MIGRATESTATEFORMAT_OP(MIGRATESTATEFORMAT, (req, rsp, h) -> copy(req.getParams().required(), null, COLLECTION_PROP)),
 
     BACKUP_OP(BACKUP, (req, rsp, h) -> {
       req.getParams().required().check(NAME, COLLECTION_PROP);
@@ -929,7 +931,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
         throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown index backup strategy " + strategy);
       }
 
-      Map<String, Object> params = req.getParams().getAll(null, NAME, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME);
+      Map<String, Object> params = copy(req.getParams(), null, NAME, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME);
       params.put(CoreAdminParams.BACKUP_LOCATION, location);
       params.put(CollectionAdminParams.INDEX_BACKUP_STRATEGY, strategy);
       return params;
@@ -977,10 +979,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
         );
       }
 
-      Map<String, Object> params = req.getParams().getAll(null, NAME, COLLECTION_PROP);
+      Map<String, Object> params = copy(req.getParams(), null, NAME, COLLECTION_PROP);
       params.put(CoreAdminParams.BACKUP_LOCATION, location);
       // from CREATE_OP:
-      req.getParams().getAll(params, COLL_CONF, REPLICATION_FACTOR, MAX_SHARDS_PER_NODE, STATE_FORMAT,
+      copy(req.getParams(), params, COLL_CONF, REPLICATION_FACTOR, MAX_SHARDS_PER_NODE, STATE_FORMAT,
           AUTO_ADD_REPLICAS, CREATE_NODE_SET, CREATE_NODE_SET_SHUFFLE);
       copyPropertiesWithPrefix(req.getParams(), params, COLL_PROP_PREFIX);
       return params;
@@ -1002,7 +1004,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
                 + collectionName + "', no action taken.");
       }
 
-      Map<String, Object> params = req.getParams().getAll(null, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME);
+      Map<String, Object> params = copy(req.getParams(), null, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME);
       return params;
     }),
     DELETESNAPSHOT_OP(DELETESNAPSHOT, (req, rsp, h) -> {
@@ -1014,7 +1016,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
         throw new SolrException(ErrorCode.BAD_REQUEST, "Collection '" + collectionName + "' does not exist, no action taken.");
       }
 
-      Map<String, Object> params = req.getParams().getAll(null, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME);
+      Map<String, Object> params = copy(req.getParams(), null, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME);
       return params;
     }),
     LISTSNAPSHOTS_OP(LISTSNAPSHOTS, (req, rsp, h) -> {
@@ -1037,7 +1039,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
       return null;
     }),
     REPLACENODE_OP(REPLACENODE, (req, rsp, h) -> {
-      return req.getParams().getAll(null,
+      return copy(req.getParams(), null,
           "source", //legacy
           "target",//legacy
           WAIT_FOR_FINAL_STATE,
@@ -1045,10 +1047,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
           CollectionParams.TARGET_NODE);
     }),
     MOVEREPLICA_OP(MOVEREPLICA, (req, rsp, h) -> {
-      Map<String, Object> map = req.getParams().required().getAll(null,
+      Map<String, Object> map = copy(req.getParams().required(), null,
           COLLECTION_PROP);
 
-      return req.getParams().getAll(map,
+      return copy(req.getParams(), map,
           CollectionParams.FROM_NODE,
           CollectionParams.SOURCE_NODE,
           CollectionParams.TARGET_NODE,
@@ -1057,7 +1059,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
           "replica",
           "shard");
     }),
-    DELETENODE_OP(DELETENODE, (req, rsp, h) -> req.getParams().required().getAll(null, "node"));
+    DELETENODE_OP(DELETENODE, (req, rsp, h) -> copy(req.getParams().required(), null, "node"));
 
     /**
      * Places all prefixed properties in the sink map (or a new map) using the prefix as the key and a map of
@@ -1318,18 +1320,28 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
     return Boolean.TRUE;
   }
 
-  /**
-   * Calls the consumer for each parameter and with all values.
-   * This may be more convenient than using the iterator.
-   */
-  //TODO put on SolrParams, or maybe SolrParams should implement Iterable<Map.Entry<String,String[]>
-  private static void forEach(SolrParams params, BiConsumer<String, String[]> consumer) {
-    //TODO do we add a predicate for the parameter as a filter? It would avoid calling getParams
-    final Iterator<String> iterator = params.getParameterNamesIterator();
-    while (iterator.hasNext()) {
-      String param = iterator.next();
-      String[] values = params.getParams(param);
-      consumer.accept(param, values);
+  // These "copy" methods were once SolrParams.getAll but were moved here as there is no universal way that
+  //  a SolrParams can be represented in a Map; there are various choices.
+
+  /**Copy all params to the given map or if the given map is null create a new one */
+  static Map<String, Object> copy(SolrParams source, Map<String, Object> sink, Collection<String> paramNames) {
+    if (sink == null) sink = new LinkedHashMap<>();
+    for (String param : paramNames) {
+      String[] v = source.getParams(param);
+      if (v != null && v.length > 0) {
+        if (v.length == 1) {
+          sink.put(param, v[0]);
+        } else {
+          sink.put(param, v);
+        }
+      }
     }
+    return sink;
   }
+
+  /**Copy all params to the given map or if the given map is null create a new one */
+  static Map<String, Object> copy(SolrParams source, Map<String, Object> sink, String... paramNames){
+    return copy(source, sink, paramNames == null ? Collections.emptyList() : Arrays.asList(paramNames));
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/admin/ConfigSetsHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ConfigSetsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ConfigSetsHandler.java
index 34313d0..49de07b 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ConfigSetsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ConfigSetsHandler.java
@@ -55,17 +55,17 @@ import org.apache.solr.security.AuthorizationContext;
 import org.apache.solr.security.PermissionNameProvider;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
-import static org.apache.solr.cloud.OverseerConfigSetMessageHandler.BASE_CONFIGSET;
-import static org.apache.solr.cloud.OverseerConfigSetMessageHandler.CONFIGSETS_ACTION_PREFIX;
-import static org.apache.solr.cloud.OverseerConfigSetMessageHandler.PROPERTY_PREFIX;
-import static org.apache.solr.common.params.CommonParams.NAME;
-import static org.apache.solr.common.params.ConfigSetParams.ConfigSetAction.*;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import static org.apache.solr.cloud.Overseer.QUEUE_OPERATION;
+import static org.apache.solr.cloud.OverseerConfigSetMessageHandler.BASE_CONFIGSET;
+import static org.apache.solr.cloud.OverseerConfigSetMessageHandler.CONFIGSETS_ACTION_PREFIX;
+import static org.apache.solr.cloud.OverseerConfigSetMessageHandler.PROPERTY_PREFIX;
+import static org.apache.solr.common.params.CommonParams.NAME;
+import static org.apache.solr.common.params.ConfigSetParams.ConfigSetAction.CREATE;
+import static org.apache.solr.common.params.ConfigSetParams.ConfigSetAction.DELETE;
+import static org.apache.solr.common.params.ConfigSetParams.ConfigSetAction.LIST;
 
 /**
  * A {@link org.apache.solr.request.SolrRequestHandler} for ConfigSets API requests.
@@ -258,14 +258,14 @@ public class ConfigSetsHandler extends RequestHandlerBase implements PermissionN
     CREATE_OP(CREATE) {
       @Override
       Map<String, Object> call(SolrQueryRequest req, SolrQueryResponse rsp, ConfigSetsHandler h) throws Exception {
-        Map<String, Object> props = req.getParams().required().getAll(null, NAME, BASE_CONFIGSET);
+        Map<String, Object> props = CollectionsHandler.copy(req.getParams().required(), null, NAME, BASE_CONFIGSET);
         return copyPropertiesWithPrefix(req.getParams(), props, PROPERTY_PREFIX + ".");
       }
     },
     DELETE_OP(DELETE) {
       @Override
       Map<String, Object> call(SolrQueryRequest req, SolrQueryResponse rsp, ConfigSetsHandler h) throws Exception {
-        return req.getParams().required().getAll(null, NAME);
+        return CollectionsHandler.copy(req.getParams().required(), null, NAME);
       }
     },
     LIST_OP(LIST) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/admin/MetricsCollectorHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/MetricsCollectorHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/MetricsCollectorHandler.java
index 3d8b6e0..7de3ac2 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/MetricsCollectorHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/MetricsCollectorHandler.java
@@ -96,7 +96,7 @@ public class MetricsCollectorHandler extends RequestHandlerBase {
   public void init(NamedList initArgs) {
     super.init(initArgs);
     if (initArgs != null) {
-      params = SolrParams.toSolrParams(initArgs);
+      params = initArgs.toSolrParams();
     } else {
       params = new ModifiableSolrParams();
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
index 6511c67..d7b8474 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
@@ -167,7 +167,7 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
 
   @Override
   public void init(NamedList args) {
-    this.initArgs = SolrParams.toSolrParams(args);
+    this.initArgs = args.toSolrParams();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/highlight/HighlightingPluginBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/highlight/HighlightingPluginBase.java b/solr/core/src/java/org/apache/solr/highlight/HighlightingPluginBase.java
index bed4a1d..5cbf123 100644
--- a/solr/core/src/java/org/apache/solr/highlight/HighlightingPluginBase.java
+++ b/solr/core/src/java/org/apache/solr/highlight/HighlightingPluginBase.java
@@ -44,7 +44,7 @@ public abstract class HighlightingPluginBase implements SolrInfoBean, SolrMetric
     if( args != null ) {
       Object o = args.get("defaults");
       if (o != null && o instanceof NamedList ) {
-        defaults = SolrParams.toSolrParams((NamedList)o);
+        defaults = ((NamedList) o).toSolrParams();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java b/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
index 3421126..889877a 100644
--- a/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
+++ b/solr/core/src/java/org/apache/solr/request/LocalSolrQueryRequest.java
@@ -16,16 +16,16 @@
  */
 package org.apache.solr.request;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.MultiMapSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-
 // With the addition of SolrParams, this class isn't needed for much anymore... it's currently
 // retained more for backward compatibility.
 
@@ -56,7 +56,7 @@ public class LocalSolrQueryRequest extends SolrQueryRequestBase {
   }
 
   public LocalSolrQueryRequest(SolrCore core, NamedList args) {
-    super(core, SolrParams.toSolrParams(args));
+    super(core, args.toSolrParams());
   }
 
   public LocalSolrQueryRequest(SolrCore core, Map<String,String[]> args) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/response/XSLTResponseWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/XSLTResponseWriter.java b/solr/core/src/java/org/apache/solr/response/XSLTResponseWriter.java
index 7b6cf00..d9cb939 100644
--- a/solr/core/src/java/org/apache/solr/response/XSLTResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/XSLTResponseWriter.java
@@ -58,7 +58,7 @@ public class XSLTResponseWriter implements QueryResponseWriter {
   
   @Override
   public void init(NamedList n) {
-      final SolrParams p = SolrParams.toSolrParams(n);
+    final SolrParams p = n.toSolrParams();
       xsltCacheLifetimeSeconds = p.getInt(XSLT_CACHE_PARAM,XSLT_CACHE_DEFAULT);
       log.info("xsltCacheLifetimeSeconds=" + xsltCacheLifetimeSeconds);
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
index ca28471..c77b572 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -973,7 +973,7 @@ public class IndexSchema {
         // configure a factory, get a similarity back
         final NamedList<Object> namedList = DOMUtil.childNodesToNamedList(node);
         namedList.add(SimilarityFactory.CLASS_NAME, classArg);
-        SolrParams params = SolrParams.toSolrParams(namedList);
+        SolrParams params = namedList.toSolrParams();
         similarityFactory = (SimilarityFactory)obj;
         similarityFactory.init(params);
       } else {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
index d4a10bd..b9f9645 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
@@ -67,7 +67,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
 
   @Override
   public void init(NamedList args) {
-    SolrParams params = SolrParams.toSolrParams(args);
+    SolrParams params = args.toSolrParams();
     isMutable = params.getBool("mutable", true);
     args.remove("mutable");
     managedSchemaResourceName = params.get(MANAGED_SCHEMA_RESOURCE_NAME, DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java b/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java
index a1f8df8..9188f54 100644
--- a/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java
+++ b/solr/core/src/java/org/apache/solr/spelling/DirectSolrSpellChecker.java
@@ -94,7 +94,7 @@ public class DirectSolrSpellChecker extends SolrSpellChecker {
   @Override
   public String init(NamedList config, SolrCore core) {
 
-    SolrParams params = SolrParams.toSolrParams(config);
+    SolrParams params = config.toSolrParams();
 
     LOG.info("init: " + config);
     String name = super.init(config, core);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
index 0cde7e9..d252d69 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
@@ -65,7 +65,7 @@ public class ClassificationUpdateProcessorFactory extends UpdateRequestProcessor
   @Override
   public void init(final NamedList args) {
     if (args != null) {
-      params = SolrParams.toSolrParams(args);
+      params = args.toSolrParams();
       classificationParams = new ClassificationUpdateProcessorParams();
 
       String fieldNames = params.get(INPUT_FIELDS_PARAM);// must be a comma separated list of fields

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java
index 6559cc7..315d6cd 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java
@@ -50,7 +50,7 @@ public class IgnoreCommitOptimizeUpdateProcessorFactory extends UpdateRequestPro
 
   @Override
   public void init(final NamedList args) {
-    SolrParams params = (args != null) ? SolrParams.toSolrParams(args) : null;
+    SolrParams params = (args != null) ? args.toSolrParams() : null;
     if (params == null) {
       errorCode = ErrorCode.FORBIDDEN; // default is 403 error
       responseMsg = DEFAULT_RESPONSE_MSG;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
index 66ec93f..06057f2 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
@@ -54,7 +54,7 @@ public class LogUpdateProcessorFactory extends UpdateRequestProcessorFactory imp
   @Override
   public void init( final NamedList args ) {
     if( args != null ) {
-      SolrParams params = SolrParams.toSolrParams( args );
+      SolrParams params = args.toSolrParams();
       maxNumToLog = params.getInt( "maxNumToLog", maxNumToLog );
       slowUpdateThresholdMillis = params.getInt("slowUpdateThresholdMillis", slowUpdateThresholdMillis);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessorFactory.java
index d39023a..263111d 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/RegexpBoostProcessorFactory.java
@@ -39,7 +39,7 @@ public class RegexpBoostProcessorFactory extends UpdateRequestProcessorFactory {
     @Override
     public void init(@SuppressWarnings("rawtypes") final NamedList args) {
         if (args != null) {
-            this.params = SolrParams.toSolrParams(args);
+          this.params = args.toSolrParams();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
index 40ef398..7257fd7 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
@@ -52,7 +52,7 @@ public class SignatureUpdateProcessorFactory
   @Override
   public void init(final NamedList args) {
     if (args != null) {
-      SolrParams params = SolrParams.toSolrParams(args);
+      SolrParams params = args.toSolrParams();
       boolean enabled = params.getBool("enabled", true);
       this.enabled = enabled;
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/java/org/apache/solr/update/processor/URLClassifyProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/URLClassifyProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/URLClassifyProcessorFactory.java
index ec85e9b..418eba3 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/URLClassifyProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/URLClassifyProcessorFactory.java
@@ -32,7 +32,7 @@ public class URLClassifyProcessorFactory extends UpdateRequestProcessorFactory {
   @Override
   public void init(@SuppressWarnings("rawtypes") final NamedList args) {
     if (args != null) {
-      this.params = SolrParams.toSolrParams(args);
+      this.params = args.toSolrParams();
     }
   }
   

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java b/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
index 2321188..ed1f663 100644
--- a/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
+++ b/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
@@ -661,7 +661,7 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {
     more.add("s", "ccc");
     more.add("ss","YYY");
     more.add("xx","XXX");
-    p = SolrParams.wrapAppended(p, SolrParams.toSolrParams(more));
+    p = SolrParams.wrapAppended(p, more.toSolrParams());
     assertEquals(3, p.getParams("s").length);
     assertEquals("bbb", p.getParams("s")[0]);
     assertEquals("aaa", p.getParams("s")[1]);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java b/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
index c08328c..3601347 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java
@@ -29,8 +29,10 @@ import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.api.Api;
 import org.apache.solr.api.ApiBag;
 import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.params.CollectionParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.MultiMapSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.CommandOperation;
@@ -42,6 +44,7 @@ import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.servlet.SolrRequestParsers;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,6 +59,26 @@ import static org.apache.solr.common.util.Utils.fromJSONString;
 public class TestCollectionAPIs extends SolrTestCaseJ4 {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+  @Test
+  public void testCopyParamsToMap() {
+    ModifiableSolrParams params = new ModifiableSolrParams();
+    params.add("x", "X1");
+    params.add("x", "X2");
+    params.add("y", "Y");
+    Map<String, Object> m = CollectionsHandler.copy(params, null, "x", "y");
+    String[] x = (String[]) m.get("x");
+    assertEquals(2, x.length);
+    assertEquals("X1", x[0]);
+    assertEquals("X2", x[1]);
+    assertEquals("Y", m.get("y"));
+    try {
+      CollectionsHandler.copy(params.required(), null, "z");
+      fail("Error expected");
+    } catch (SolrException e) {
+      assertEquals(e.code(), SolrException.ErrorCode.BAD_REQUEST.code);
+
+    }
+  }
 
   public void testCommands() throws Exception {
     MockCollectionsHandler collectionsHandler = new MockCollectionsHandler();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
index 9f4efac..c0fd054 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
@@ -18,37 +18,38 @@
 package org.apache.solr.client.solrj.io.graph;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
-import java.util.HashSet;
-import java.util.ArrayList;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
 
-import org.apache.solr.client.solrj.io.eq.MultipleFieldEqualitor;
-import org.apache.solr.client.solrj.io.stream.*;
-import org.apache.solr.client.solrj.io.stream.metrics.*;
 import org.apache.solr.client.solrj.io.Tuple;
 import org.apache.solr.client.solrj.io.comp.StreamComparator;
 import org.apache.solr.client.solrj.io.eq.FieldEqualitor;
+import org.apache.solr.client.solrj.io.eq.MultipleFieldEqualitor;
+import org.apache.solr.client.solrj.io.stream.CloudSolrStream;
+import org.apache.solr.client.solrj.io.stream.StreamContext;
+import org.apache.solr.client.solrj.io.stream.TupleStream;
+import org.apache.solr.client.solrj.io.stream.UniqueStream;
 import org.apache.solr.client.solrj.io.stream.expr.Explanation;
+import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
 import org.apache.solr.client.solrj.io.stream.expr.Expressible;
 import org.apache.solr.client.solrj.io.stream.expr.StreamExplanation;
 import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
 import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter;
 import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionValue;
 import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
-import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
+import org.apache.solr.client.solrj.io.stream.metrics.Metric;
 import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.ExecutorUtil;
-import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SolrjNamedThreadFactory;
 
 import static org.apache.solr.common.params.CommonParams.SORT;
@@ -451,7 +452,8 @@ public class GatherNodesStream extends TupleStream implements Expressible {
         }
       }
       
-      ModifiableSolrParams joinSParams = new ModifiableSolrParams(SolrParams.toMultiMap(new NamedList(queryParams)));
+      ModifiableSolrParams joinSParams = new ModifiableSolrParams();
+      queryParams.forEach(joinSParams::add);
       joinSParams.set("fl", buf.toString());
       joinSParams.set("qt", "/export");
       joinSParams.set(SORT, gather + " asc,"+traverseTo +" asc");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
index b191085..4010ff42 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
@@ -18,13 +18,14 @@ package org.apache.solr.client.solrj.io.stream;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Map.Entry;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
@@ -303,9 +304,8 @@ public class FacetStream extends TupleStream implements Expressible  {
     
     child.setImplementingClass("Solr/Lucene");
     child.setExpressionType(ExpressionType.DATASTORE);
-    ModifiableSolrParams tmpParams = new ModifiableSolrParams(SolrParams.toMultiMap(params.toNamedList()));
 
-    child.setExpression(tmpParams.getMap().entrySet().stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), e.getValue())).collect(Collectors.joining(",")));
+    child.setExpression(params.stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), Arrays.toString(e.getValue()))).collect(Collectors.joining(",")));
     
     explanation.addChild(child);
     

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SqlStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SqlStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SqlStream.java
index 100d722..2fb2aa6 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SqlStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/SqlStream.java
@@ -124,8 +124,7 @@ public class SqlStream extends TupleStream implements Expressible {
 
     // parameters
 
-    ModifiableSolrParams mParams = new ModifiableSolrParams(SolrParams.toMultiMap(params.toNamedList()));
-    for (Entry<String, String[]> param : mParams.getMap().entrySet()) {
+    for (Entry<String, String[]> param : params) {
       String value = String.join(",", param.getValue());
 
       // SOLR-8409: This is a special case where the params contain a " character

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java
index 610a6df..cb743e9 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/TimeSeriesStream.java
@@ -21,6 +21,7 @@ import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -256,9 +257,8 @@ public class TimeSeriesStream extends TupleStream implements Expressible  {
 
     child.setImplementingClass("Solr/Lucene");
     child.setExpressionType(ExpressionType.DATASTORE);
-    ModifiableSolrParams tmpParams = new ModifiableSolrParams(SolrParams.toMultiMap(params.toNamedList()));
 
-    child.setExpression(tmpParams.getMap().entrySet().stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), e.getValue())).collect(Collectors.joining(",")));
+    child.setExpression(params.stream().map(e -> String.format(Locale.ROOT, "%s=%s", e.getKey(), Arrays.toString(e.getValue()))).collect(Collectors.joining(",")));
 
     explanation.addChild(child);
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
index 5759a6c..dde6dba 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
@@ -146,7 +146,7 @@ public class JavaBinUpdateRequestCodec {
 
       private List readOuterMostDocIterator(DataInputInputStream fis) throws IOException {
         NamedList params = (NamedList) namedList[0].get("params");
-        updateRequest.setParams(new ModifiableSolrParams(SolrParams.toSolrParams(params)));
+        updateRequest.setParams(new ModifiableSolrParams(params.toSolrParams()));
         if (handler == null) return super.readIterator(fis);
         Integer commitWithin = null;
         Boolean overwrite = null;
@@ -165,7 +165,7 @@ public class JavaBinUpdateRequestCodec {
             sdoc = listToSolrInputDocument((List<NamedList>) o);
           } else if (o instanceof NamedList)  {
             UpdateRequest req = new UpdateRequest();
-            req.setParams(new ModifiableSolrParams(SolrParams.toSolrParams((NamedList) o)));
+            req.setParams(new ModifiableSolrParams(((NamedList) o).toSolrParams()));
             handler.update(null, req, null, null);
           } else if (o instanceof Map.Entry){
             sdoc = (SolrInputDocument) ((Map.Entry) o).getKey();
@@ -200,7 +200,7 @@ public class JavaBinUpdateRequestCodec {
     if(updateRequest.getParams()==null) {
       NamedList params = (NamedList) namedList[0].get("params");
       if(params!=null) {
-        updateRequest.setParams(new ModifiableSolrParams(SolrParams.toSolrParams(params)));
+        updateRequest.setParams(new ModifiableSolrParams(params.toSolrParams()));
       }
     }
     delById = (List<String>) namedList[0].get("delById");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/MapWriter.java b/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
index 71e084c..1fba397 100644
--- a/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/MapWriter.java
@@ -29,13 +29,14 @@ import org.apache.solr.common.util.Utils;
 /**
  * Use this class to push all entries of a Map into an output.
  * This avoids creating map instances and is supposed to be memory efficient.
- * If the entries are primitives, unnecessary boxing is also avoided
+ * If the entries are primitives, unnecessary boxing is also avoided.
  */
 public interface MapWriter extends MapSerializable {
 
   default String jsonStr(){
     return Utils.toJSONString(this);
   }
+
   @Override
   default Map toMap(Map<String, Object> map) {
     try {
@@ -64,6 +65,8 @@ public interface MapWriter extends MapSerializable {
             v = map;
           }
           map.put(k, v);
+          // note: It'd be nice to assert that there is no previous value at 'k' but it's possible the passed in
+          // map is already populated and the intention is to overwrite.
           return this;
         }
 
@@ -77,7 +80,9 @@ public interface MapWriter extends MapSerializable {
   void writeMap(EntryWriter ew) throws IOException;
 
   /**
-   * An interface to push one entry at a time to the output
+   * An interface to push one entry at a time to the output.
+   * The order of the keys is not defined, but we assume they are distinct -- don't call {@code put} more than once
+   * for the same key.
    */
   interface EntryWriter {
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
index b78c652..08022b2 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
@@ -457,6 +457,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma
   }
 
   /** Create a Map&lt;String,String&gt; from a NamedList given no keys are repeated */
+  @Deprecated // Doesn't belong here (no SolrParams).  Just remove.
   public static Map<String,String> toMap(NamedList params) {
     HashMap<String,String> map = new HashMap<>();
     for (int i=0; i<params.size(); i++) {
@@ -466,6 +467,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma
   }
 
   /** Create a Map&lt;String,String[]&gt; from a NamedList */
+  @Deprecated // Doesn't belong here (no SolrParams).  Just remove.
   public static Map<String,String[]> toMultiMap(NamedList params) {
     HashMap<String,String[]> map = new HashMap<>();
     for (int i=0; i<params.size(); i++) {
@@ -487,14 +489,19 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma
     return map;
   }
 
-  /** Create SolrParams from NamedList. */
+  /**
+   * Create SolrParams from NamedList.
+   * @deprecated Use {@link NamedList#toSolrParams()}.
+   */
+  @Deprecated //move to NamedList to allow easier flow
   public static SolrParams toSolrParams(NamedList params) {
-    // always use MultiMap for easier processing further down the chain
-    return new MultiMapSolrParams(toMultiMap(params));
+    return params.toSolrParams();
   }
 
-  /** Create filtered SolrParams. */
+  @Deprecated
   public SolrParams toFilteredSolrParams(List<String> names) {
+    // TODO do this better somehow via a view that filters?  See SolrCore.preDecorateResponse.
+    //   ... and/or add some optional predicates to iterator()?
     NamedList<String> nl = new NamedList<>();
     for (Iterator<String> it = getParameterNamesIterator(); it.hasNext();) {
       final String name = it.next();
@@ -505,7 +512,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma
         }
       }
     }
-    return toSolrParams(nl);
+    return nl.toSolrParams();
   }
 
   /**
@@ -528,6 +535,10 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma
     return result;
   }
 
+  // Deprecated because there isn't a universal way to deal with multi-values (always
+  //  String[] or only for > 1 or always 1st value).  And what to do with nulls or empty string.
+  //  And SolrParams now implements MapWriter.toMap(Map) (a default method).  So what do we do?
+  @Deprecated
   public Map<String, Object> getAll(Map<String, Object> sink, Collection<String> params) {
     if (sink == null) sink = new LinkedHashMap<>();
     for (String param : params) {
@@ -547,6 +558,7 @@ public abstract class SolrParams implements Serializable, MapWriter, Iterable<Ma
   /**Copy all params to the given map or if the given map is null
    * create a new one
    */
+  @Deprecated
   public Map<String, Object> getAll(Map<String, Object> sink, String... params){
     return getAll(sink, params == null ? Collections.emptyList() : Arrays.asList(params));
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
index d34d8e7..1650602 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -29,6 +30,8 @@ import java.util.Set;
 import java.util.function.BiConsumer;
 
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.MultiMapSolrParams;
+import org.apache.solr.common.params.SolrParams;
 
 /**
  * A simple container class for modeling an ordered list of name/value pairs.
@@ -514,6 +517,33 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry
     }
     return result;
   }
+  /**
+   * Create SolrParams from NamedList.  Values must be {@code String[]} or {@code List}
+   * (with toString()-appropriate entries), or otherwise have a toString()-appropriate value.
+   * Nulls are retained as such in arrays/lists but otherwise will NPE.
+   */
+  public SolrParams toSolrParams() {
+    HashMap<String,String[]> map = new HashMap<>();
+    for (int i=0; i<this.size(); i++) {
+      String name = this.getName(i);
+      Object val = this.getVal(i);
+      if (val instanceof String[]) {
+        MultiMapSolrParams.addParam(name, (String[]) val, map);
+      } else if (val instanceof List) {
+        List l = (List) val;
+        String[] s = new String[l.size()];
+        for (int j = 0; j < l.size(); j++) {
+          s[j] = l.get(j) == null ? null : l.get(j).toString();
+        }
+        MultiMapSolrParams.addParam(name, s, map);
+      } else {
+        //TODO: we NPE if val is null; yet we support val members above. A bug?
+        MultiMapSolrParams.addParam(name, val.toString(), map);
+      }
+    }
+    // always use MultiMap for easier processing further down the chain
+    return new MultiMapSolrParams(map);
+  }
 
   /**
    * 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9e36c51e/solr/solrj/src/test/org/apache/solr/common/params/SolrParamTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/params/SolrParamTest.java b/solr/solrj/src/test/org/apache/solr/common/params/SolrParamTest.java
index a2cb9bd..f079828 100644
--- a/solr/solrj/src/test/org/apache/solr/common/params/SolrParamTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/params/SolrParamTest.java
@@ -16,16 +16,14 @@
  */
 package org.apache.solr.common.params;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.util.NamedList;
 
 /**
  */
@@ -127,36 +125,6 @@ public class SolrParamTest extends LuceneTestCase {
 
   }
 
-  public void testMultiValues() {
-    NamedList nl = new NamedList();
-    nl.add("x", "X1");
-    nl.add("x", "X2");
-    nl.add("x", new String[]{"X3", "X4"});
-    Map<String, String[]> m = SolrParams.toMultiMap(nl);
-    String[] r = m.get("x");
-    assertTrue(Arrays.asList(r).containsAll(Arrays.asList(new String[]{"X1", "X2", "X3", "X4"})));
-  }
-
-  public void testGetAll() {
-    ModifiableSolrParams params = new ModifiableSolrParams();
-    params.add("x", "X1");
-    params.add("x", "X2");
-    params.add("y", "Y");
-    Map<String, Object> m = params.getAll(null, "x", "y");
-    String[] x = (String[]) m.get("x");
-    assertEquals(2, x.length);
-    assertEquals("X1", x[0]);
-    assertEquals("X2", x[1]);
-    assertEquals("Y", m.get("y"));
-    try {
-      params.required().getAll(null, "z");
-      fail("Error expected");
-    } catch (SolrException e) {
-      assertEquals(e.code(), SolrException.ErrorCode.BAD_REQUEST.code);
-
-    }
-  }
-
   public void testModParamAddParams() {
 
     ModifiableSolrParams aaa = new ModifiableSolrParams();


Mime
View raw message