SOLR-9740: fix macro expansion of multi-valued parameters

This commit is contained in:
yonik 2016-11-08 18:01:02 -05:00
parent da841be887
commit 11840469d9
3 changed files with 20 additions and 0 deletions

View File

@ -136,6 +136,11 @@ Bug Fixes
of matching something due to filter exclusions (which can widen the domain again).
(Michael Sun, yonik)
* SOLR-9740: A bug in macro expansion of multi-valued parameters caused non-expanded values
after the first expanded value in the same multi-valued parameter to be dropped.
(Erik Hatcher, yonik)
Other Changes
----------------------

View File

@ -71,6 +71,8 @@ public class MacroExpander {
newValues.add(vv);
}
}
}
if (newValues != null) {
newValues.add(newV);
}
}

View File

@ -113,4 +113,17 @@ public class TestMacroExpander extends LuceneTestCase {
}
}
@Test
public void testMap() { // see SOLR-9740, the second fq param was being dropped.
final Map<String,String[]> request = new HashMap<>();
request.put("fq", new String[] {"zero", "${one_ref}", "two", "${three_ref}"});
request.put("one_ref",new String[] {"one"});
request.put("three_ref",new String[] {"three"});
Map expanded = MacroExpander.expand(request);
assertEquals("zero", ((String[])expanded.get("fq"))[0]);
assertEquals("one", ((String[])expanded.get("fq"))[1]);
assertEquals("two", ((String[]) expanded.get("fq"))[2]);
assertEquals("three", ((String[]) expanded.get("fq"))[3]);
}
}