mirror of https://github.com/apache/lucene.git
SOLR-7941: multivalued params are concatenated when using config API
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1696453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
490fd35388
commit
8589202889
|
@ -142,6 +142,8 @@ Bug Fixes
|
|||
* SOLR-7935: Fix very rare race condition that can cause an update to fail
|
||||
via NullPointerException during a core reload. (yonik)
|
||||
|
||||
* SOLR-7941: multivalued params are concatenated when using config API (noble)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -46,9 +46,12 @@ public class DumpRequestHandler extends RequestHandlerBase
|
|||
for (String returnParam : returnParams) {
|
||||
String[] vals = req.getParams().getParams(returnParam);
|
||||
if(vals != null){
|
||||
for (String val : vals) {
|
||||
params.add(returnParam,val);
|
||||
if (vals.length == 1) {
|
||||
params.add(returnParam, vals[0]);
|
||||
} else {
|
||||
params.add(returnParam, vals);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class TestSolrConfigHandler extends RestTestBase {
|
|||
10);
|
||||
|
||||
payload = "{\n" +
|
||||
"'update-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy' , 'a':'b' , 'defaults': {'def_a':'def A val'}}\n" +
|
||||
"'update-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy' , 'a':'b' , 'defaults': {'def_a':'def A val', 'multival':['a','b','c']}}\n" +
|
||||
"}";
|
||||
runConfigCommand(writeHarness, "/config?wt=json", payload);
|
||||
|
||||
|
@ -209,6 +209,14 @@ public class TestSolrConfigHandler extends RestTestBase {
|
|||
"def A val",
|
||||
10);
|
||||
|
||||
testForResponseElement(writeHarness,
|
||||
testServerBaseUrl,
|
||||
"/x?wt=json¶m=multival&json.nl=map",
|
||||
cloudSolrClient,
|
||||
Arrays.asList("params", "multival"),
|
||||
Arrays.asList("a", "b", "c"),
|
||||
10);
|
||||
|
||||
payload = "{\n" +
|
||||
"'delete-requesthandler' : '/x'" +
|
||||
"}";
|
||||
|
|
|
@ -316,6 +316,13 @@ public abstract class SolrParams implements Serializable {
|
|||
Object val = params.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 : String.valueOf(l.get(j));
|
||||
}
|
||||
MultiMapSolrParams.addParam(name, s, map);
|
||||
} else {
|
||||
MultiMapSolrParams.addParam(name, val.toString(), map);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue