From 691472c0f0898ab99d16158ce5a6def60f754206 Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Mon, 26 Sep 2016 16:59:15 +0530 Subject: [PATCH] SOLR-9557: Every implicit requesthandler now has a default 'useParams' attribute --- 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(-) create mode 100644 solr/server/solr/configsets/sample_techproducts_configs/conf/params.json diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 064aa9fc359..7bb86889dbc 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 ---------------------- 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 374e901f65f..381af2926db 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)) { diff --git a/solr/core/src/resources/ImplicitPlugins.json b/solr/core/src/resources/ImplicitPlugins.json index 58f6b79c209..e74cc2adb48 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" ] 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 00000000000..ac72676a78a --- /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 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 c8f52a6ae2a..d2401076fbf 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 @@ - - - - _src_ - - true - - - -