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

This commit is contained in:
Noble Paul 2016-09-26 16:59:15 +05:30
parent 6687244667
commit 691472c0f0
6 changed files with 52 additions and 22 deletions

View File

@ -102,6 +102,9 @@ New Features
* SOLR-9558: DIH TemplateTransformerto to support multivalued fields (Ted Sullivan via noble) * 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 Bug Fixes
---------------------- ----------------------

View File

@ -84,6 +84,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap; 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.APPENDS;
import static org.apache.solr.core.PluginInfo.DEFAULTS; import static org.apache.solr.core.PluginInfo.DEFAULTS;
import static org.apache.solr.core.PluginInfo.INVARIANTS; import static org.apache.solr.core.PluginInfo.INVARIANTS;
@ -184,6 +185,7 @@ public class SolrPluginUtils {
if (paramSets == null) return defaults; if (paramSets == null) return defaults;
for (String name : StrUtils.splitSmart(paramSets, ',')) { for (String name : StrUtils.splitSmart(paramSets, ',')) {
RequestParams.VersionedParams params = requestParams.getParams(name, type); RequestParams.VersionedParams params = requestParams.getParams(name, type);
if (params == null) return defaults;
if (type.equals(DEFAULTS)) { if (type.equals(DEFAULTS)) {
defaults = SolrParams.wrapDefaults(params, defaults); defaults = SolrParams.wrapDefaults(params, defaults);
} else if (type.equals(INVARIANTS)) { } else if (type.equals(INVARIANTS)) {

View File

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

View File

@ -0,0 +1,11 @@
{
"params": {
"_UPDATE_JSON_DOCS": {
"srcField": "_src_",
"mapUniqueKeyOnly": true,
"": {
"v": 0
}
}
}
}

View File

@ -952,18 +952,6 @@
</lst> </lst>
</initParams> </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 <!-- The following are implicitly added
<requestHandler name="/update/json" class="solr.UpdateRequestHandler"> <requestHandler name="/update/json" class="solr.UpdateRequestHandler">
<lst name="defaults"> <lst name="defaults">

View File

@ -26,6 +26,8 @@ import java.util.Locale;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import static java.util.Collections.singletonList;
/** /**
* *
*/ */
@ -39,6 +41,7 @@ public class StrUtils {
* outside strings. * outside strings.
*/ */
public static List<String> splitSmart(String s, char separator) { public static List<String> splitSmart(String s, char separator) {
if(s.indexOf(separator) == -1) return singletonList(s);
ArrayList<String> lst = new ArrayList<>(4); ArrayList<String> lst = new ArrayList<>(4);
int pos=0, start=0, end=s.length(); int pos=0, start=0, end=s.length();
char inString=0; char inString=0;