mirror of https://github.com/apache/lucene.git
SOLR-9198: config APIs unable to add multiple values with same name
This commit is contained in:
parent
86c053dd10
commit
be01109744
|
@ -258,6 +258,8 @@ Bug Fixes
|
||||||
|
|
||||||
* SOLR-8676: keep LOG4J_CONFIG in solr.cmd (Kristine Jetzke via Mikhail Khludnev)
|
* SOLR-8676: keep LOG4J_CONFIG in solr.cmd (Kristine Jetzke via Mikhail Khludnev)
|
||||||
|
|
||||||
|
* SOLR-9198: config APIs unable to add multiple values with same name (noble)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.
|
* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.
|
||||||
|
|
|
@ -67,8 +67,20 @@ public class PluginInfo implements MapSerializable{
|
||||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
if (NAME.equals(entry.getKey()) || CLASS_NAME.equals(entry.getKey())) continue;
|
if (NAME.equals(entry.getKey()) || CLASS_NAME.equals(entry.getKey())) continue;
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
if (value instanceof Map) value = new NamedList((Map) value);
|
if (value instanceof List) {
|
||||||
initArgs.add(entry.getKey(), value);
|
List list = (List) value;
|
||||||
|
if (!list.isEmpty() && list.get(0) instanceof Map) {//this is a subcomponent
|
||||||
|
for (Object o : list) {
|
||||||
|
if (o instanceof Map) o = new NamedList<>((Map) o);
|
||||||
|
initArgs.add(entry.getKey(), o);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
initArgs.add(entry.getKey(), value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (value instanceof Map) value = new NamedList((Map) value);
|
||||||
|
initArgs.add(entry.getKey(), value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.name = (String) m.get(NAME);
|
this.name = (String) m.get(NAME);
|
||||||
|
|
|
@ -426,6 +426,30 @@ public class TestSolrConfigHandler extends RestTestBase {
|
||||||
Arrays.asList("config", "searchComponent","myspellcheck", "spellchecker", "class"),
|
Arrays.asList("config", "searchComponent","myspellcheck", "spellchecker", "class"),
|
||||||
"solr.DirectSolrSpellChecker",
|
"solr.DirectSolrSpellChecker",
|
||||||
10);
|
10);
|
||||||
|
|
||||||
|
payload = "{\n" +
|
||||||
|
" 'add-requesthandler': {\n" +
|
||||||
|
" name : '/dump100',\n" +
|
||||||
|
" class : 'org.apache.solr.handler.DumpRequestHandler'," +
|
||||||
|
" suggester: [{name: s1,lookupImpl: FuzzyLookupFactory, dictionaryImpl : DocumentDictionaryFactory}," +
|
||||||
|
" {name: s2,lookupImpl: FuzzyLookupFactory , dictionaryImpl : DocumentExpressionDictionaryFactory}]" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
runConfigCommand(writeHarness, "/config?wt=json", payload);
|
||||||
|
map = testForResponseElement(writeHarness,
|
||||||
|
testServerBaseUrl,
|
||||||
|
"/config?wt=json",
|
||||||
|
cloudSolrClient,
|
||||||
|
Arrays.asList("config", "requestHandler","/dump100", "class"),
|
||||||
|
"org.apache.solr.handler.DumpRequestHandler",
|
||||||
|
10);
|
||||||
|
|
||||||
|
map = getRespMap("/dump100?wt=json&json.nl=arrmap&initArgs=true", writeHarness);
|
||||||
|
List initArgs = (List) map.get("initArgs");
|
||||||
|
assertEquals(2, initArgs.size());
|
||||||
|
assertTrue(((Map)initArgs.get(0)).containsKey("suggester"));
|
||||||
|
assertTrue(((Map)initArgs.get(1)).containsKey("suggester"));
|
||||||
|
System.out.println(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map testForResponseElement(RestTestHarness harness,
|
public static Map testForResponseElement(RestTestHarness harness,
|
||||||
|
|
Loading…
Reference in New Issue