You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/09/26 11:30:41 UTC

lucene-solr:master: SOLR-9557: Every implicit requesthandler now has a default 'useParams' attribute

Repository: lucene-solr
Updated Branches:
  refs/heads/master 668724466 -> 691472c0f


SOLR-9557: Every implicit requesthandler now has a default 'useParams' attribute


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

Branch: refs/heads/master
Commit: 691472c0f0898ab99d16158ce5a6def60f754206
Parents: 6687244
Author: Noble Paul <no...@apache.org>
Authored: Mon Sep 26 16:59:15 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Mon Sep 26 17:00:17 2016 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  3 ++
 .../org/apache/solr/util/SolrPluginUtils.java   |  2 +
 solr/core/src/resources/ImplicitPlugins.json    | 43 +++++++++++++++-----
 .../conf/params.json                            | 11 +++++
 .../conf/solrconfig.xml                         | 12 ------
 .../org/apache/solr/common/util/StrUtils.java   |  3 ++
 6 files changed, 52 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/691472c0/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 064aa9f..7bb8688 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -102,6 +102,9 @@ New Features
 
 * SOLR-9558: DIH TemplateTransformerto to support multivalued fields (Ted Sullivan via noble)
 
+* SOLR-9557: Every implicit requesthandler now has a default 'useParams' attribute (noble)
+
+
 Bug Fixes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/691472c0/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java b/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
index 374e901..381af29 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
@@ -84,6 +84,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableMap;
 
+import static java.util.Collections.singletonList;
 import static org.apache.solr.core.PluginInfo.APPENDS;
 import static org.apache.solr.core.PluginInfo.DEFAULTS;
 import static org.apache.solr.core.PluginInfo.INVARIANTS;
@@ -184,6 +185,7 @@ public class SolrPluginUtils {
     if (paramSets == null) return defaults;
     for (String name : StrUtils.splitSmart(paramSets, ',')) {
       RequestParams.VersionedParams params = requestParams.getParams(name, type);
+      if (params == null) return defaults;
       if (type.equals(DEFAULTS)) {
         defaults = SolrParams.wrapDefaults(params, defaults);
       } else if (type.equals(INVARIANTS)) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/691472c0/solr/core/src/resources/ImplicitPlugins.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/ImplicitPlugins.json b/solr/core/src/resources/ImplicitPlugins.json
index 58f6b79..e74cc2a 100644
--- a/solr/core/src/resources/ImplicitPlugins.json
+++ b/solr/core/src/resources/ImplicitPlugins.json
@@ -1,21 +1,25 @@
 {
   "requestHandler": {
     "/update": {
+      "useParams":"_UPDATE",
       "class": "solr.UpdateRequestHandler"
     },
     "/update/json": {
+      "useParams":"_UPDATE_JSON",
       "class": "solr.UpdateRequestHandler",
       "invariants": {
         "update.contentType": "application/json"
       }
     },
     "/update/csv": {
+      "useParams":"_UPDATE_CSV",
       "class": "solr.UpdateRequestHandler",
       "invariants": {
         "update.contentType": "application/csv"
       }
     },
     "/update/json/docs": {
+      "useParams":"_UPDATE_JSON_DOCS",
       "class": "solr.UpdateRequestHandler",
       "invariants": {
         "update.contentType": "application/json",
@@ -23,16 +27,21 @@
       }
     },
     "/config": {
+      "useParams":"_CONFIG",
       "class": "solr.SolrConfigHandler"
     },
     "/schema": {
-      "class": "solr.SchemaHandler"
+      "class": "solr.SchemaHandler",
+      "useParams":"_SCHEMA"
+
     },
     "/replication": {
-      "class": "solr.ReplicationHandler"
+      "class": "solr.ReplicationHandler",
+      "useParams":"_REPLICATION"
     },
     "/get": {
       "class": "solr.RealTimeGetHandler",
+      "useParams":"_GET",
       "defaults": {
         "omitHeader": true,
         "wt": "json",
@@ -41,40 +50,50 @@
     },
     "/admin/ping": {
       "class": "solr.PingRequestHandler",
+      "useParams":"_ADMIN_PING",
       "invariants": {
         "echoParams": "all",
         "q": "{!lucene}*:*"
       }
     },
     "/admin/segments": {
-      "class": "solr.SegmentsInfoRequestHandler"
+      "class": "solr.SegmentsInfoRequestHandler",
+      "useParams":"_ADMIN_SEGMENTS"
     },
     "/admin/luke": {
-      "class": "solr.LukeRequestHandler"
+      "class": "solr.LukeRequestHandler",
+      "useParams":"_ADMIN_LUKE"
     },
     "/admin/system": {
-      "class": "solr.SystemInfoHandler"
+      "class": "solr.SystemInfoHandler",
+      "useParams":"_ADMIN_SYSTEM"
     },
     "/admin/mbeans": {
-      "class": "solr.SolrInfoMBeanHandler"
+      "class": "solr.SolrInfoMBeanHandler",
+      "useParams":"_ADMIN_MBEANS"
     },
     "/admin/plugins": {
       "class": "solr.PluginInfoHandler"
     },
     "/admin/threads": {
-      "class": "solr.ThreadDumpHandler"
+      "class": "solr.ThreadDumpHandler",
+      "useParams":"_ADMIN_THREADS"
     },
     "/admin/properties": {
-      "class": "solr.PropertiesRequestHandler"
+      "class": "solr.PropertiesRequestHandler",
+      "useParams":"_ADMIN_PROPERTIES"
     },
     "/admin/logging": {
-      "class": "solr.LoggingHandler"
+      "class": "solr.LoggingHandler",
+      "useParams":"_ADMIN_LOGGING"
     },
     "/admin/file": {
-      "class": "solr.ShowFileRequestHandler"
+      "class": "solr.ShowFileRequestHandler",
+      "useParams":"_ADMIN_FILE"
     },
     "/export": {
       "class": "solr.SearchHandler",
+      "useParams":"_EXPORT",
       "components": [
         "query"
       ],
@@ -86,6 +105,7 @@
     },
     "/graph": {
       "class": "solr.GraphHandler",
+      "useParams":"_ADMIN_GRAPH",
       "invariants": {
         "wt": "graphml",
         "distrib": false
@@ -93,6 +113,7 @@
     },
     "/stream": {
       "class": "solr.StreamHandler",
+      "useParams":"_STREAM",
       "invariants": {
         "wt": "json",
         "distrib": false
@@ -100,6 +121,7 @@
     },
     "/sql": {
       "class": "solr.SQLHandler",
+      "useParams":"_SQL",
       "invariants": {
         "wt": "json",
         "distrib": false
@@ -107,6 +129,7 @@
     },
     "/terms": {
       "class": "solr.SearchHandler",
+      "useParams":"_TERMS",
       "components": [
         "terms"
       ]

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/691472c0/solr/server/solr/configsets/sample_techproducts_configs/conf/params.json
----------------------------------------------------------------------
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/params.json b/solr/server/solr/configsets/sample_techproducts_configs/conf/params.json
new file mode 100644
index 0000000..ac72676
--- /dev/null
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/params.json
@@ -0,0 +1,11 @@
+{
+  "params": {
+    "_UPDATE_JSON_DOCS": {
+      "srcField": "_src_",
+      "mapUniqueKeyOnly": true,
+      "": {
+        "v": 0
+      }
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/691472c0/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
index c8f52a6..d240107 100644
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
@@ -952,18 +952,6 @@
     </lst>
   </initParams>
 
-  <initParams path="/update/json/docs">
-    <lst name="defaults">
-      <!--this ensures that the entire json doc will be stored verbatim into one field-->
-      <str name="srcField">_src_</str>
-      <!--This means a the uniqueKeyField will be extracted from the fields and
-       all fields go into the 'df' field. In this config df is already configured to be 'text'
-        -->
-      <str name="mapUniqueKeyOnly">true</str>
-    </lst>
-
-  </initParams>
-
   <!-- The following are implicitly added
   <requestHandler name="/update/json" class="solr.UpdateRequestHandler">
         <lst name="defaults">

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/691472c0/solr/solrj/src/java/org/apache/solr/common/util/StrUtils.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/StrUtils.java b/solr/solrj/src/java/org/apache/solr/common/util/StrUtils.java
index 995e142..d414177 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/StrUtils.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/StrUtils.java
@@ -26,6 +26,8 @@ import java.util.Locale;
 
 import org.apache.solr.common.SolrException;
 
+import static java.util.Collections.singletonList;
+
 /**
  *
  */
@@ -39,6 +41,7 @@ public class StrUtils {
    * outside strings.
    */
   public static List<String> splitSmart(String s, char separator) {
+    if(s.indexOf(separator) == -1) return singletonList(s);
     ArrayList<String> lst = new ArrayList<>(4);
     int pos=0, start=0, end=s.length();
     char inString=0;