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-9557: Every implicit requesthandler now has a default 'useParams' attribute (noble)
Bug Fixes
----------------------

View File

@ -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)) {

View File

@ -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"
]

View File

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

View File

@ -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">

View File

@ -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;