mirror of
https://github.com/apache/lucene.git
synced 2025-02-07 10:38:40 +00:00
SOLR-2039: Multivalued fields with dynamic names does not work properly with DIH
(cherry picked from commit b8d9647)
This commit is contained in:
parent
de360d62cc
commit
279647a303
@ -177,6 +177,9 @@ Bug Fixes
|
||||
|
||||
* SOLR-9536: OldBackupDirectory timestamp field needs to be initialized to avoid NPE.
|
||||
(Hrishikesh Gadre, hossman via Mark Miller)
|
||||
|
||||
* SOLR-2039: Multivalued fields with dynamic names does not work properly with DIH.
|
||||
(K A, ruslan.shv, Cao Manh Dat via shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
@ -501,7 +501,9 @@ public class DocBuilder {
|
||||
doc.addChildDocument(childDoc);
|
||||
} else {
|
||||
handleSpecialCommands(arow, doc);
|
||||
vr.addNamespace(epw.getEntity().getName(), arow);
|
||||
addFields(epw.getEntity(), doc, arow, vr);
|
||||
vr.removeNamespace(epw.getEntity().getName());
|
||||
}
|
||||
}
|
||||
if (epw.getEntity().getChildren() != null) {
|
||||
|
@ -115,6 +115,20 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
||||
assertQ(req("desc:ApacheSolr"), "//*[@numFound='1']");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDynamicFieldNames() throws Exception {
|
||||
List rows = new ArrayList();
|
||||
rows.add(createMap("mypk", "101", "text", "ApacheSolr"));
|
||||
MockDataSource.setIterator("select * from x", rows.iterator());
|
||||
|
||||
LocalSolrQueryRequest request = lrf.makeRequest("command", "full-import",
|
||||
"debug", "on", "clean", "true", "commit", "true",
|
||||
"dataConfig", dataConfigWithDynamicFieldNames);
|
||||
h.query("/dataimport", request);
|
||||
assertQ(req("id:101"), "//*[@numFound='1']", "//*[@name='101_s']");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testRequestParamsAsFieldName() throws Exception {
|
||||
@ -398,6 +412,15 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
|
||||
" </document>\n" +
|
||||
"</dataConfig>";
|
||||
|
||||
private final String dataConfigWithDynamicFieldNames = "<dataConfig><dataSource type=\"MockDataSource\"/>\n" +
|
||||
" <document>\n" +
|
||||
" <entity name=\"books\" query=\"select * from x\">\n" +
|
||||
" <field column=\"mypk\" name=\"id\" />\n" +
|
||||
" <field column=\"text\" name=\"${books.mypk}_s\" />\n" +
|
||||
" </entity>\n" +
|
||||
" </document>\n" +
|
||||
"</dataConfig>";
|
||||
|
||||
private final String dataConfigFileList = "<dataConfig>\n" +
|
||||
"\t<document>\n" +
|
||||
"\t\t<entity name=\"x\" processor=\"FileListEntityProcessor\" \n" +
|
||||
|
Loading…
x
Reference in New Issue
Block a user