Solr - DataImportHandler: When attempting to use column values as field names, multivalued fields only retain the first result

[亡魂溺海] 提交于 2019-12-08 01:01:33

问题


I'm trying to perform a full-import with document configuration similar to the following:

<document>
    <entity name="parent" query="select * from parent_table" >
        <field name="id" column="ID" />
        <entity name="child" query="select * from child_table where PARENT_ID = ${parent.ID}" transformer="ClobTransformer" >
            <field name="${child.FIELD_COLUMN}" column="VALUE_COLUMN" clob="true" />
        </entity>
    </entity>
</document>


Let's say the field/value results from the child_table for parent.ID=1 look like this:

FIELD_COLUMN   VALUE_COLUMN
fieldA         value1
fieldB         value2
fieldB         value3

And the schema configuration for fieldA and fieldB (note that fieldB is multivalued):

<field name="fieldA" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="fieldB" type="string" indexed="true" stored="true" multiValued="true" /> 

After running full-import, the document for parent 1 looks like this:

{"id":1,
"fieldA":"value1",
"fieldB":["value2"]}

But, I need (and was expecting) it to look like this instead (fieldB should have multiple values):

{"id":1,
"fieldA":"value1",
"fieldB":["value2","value3"]}


Any help would be greatly appreciated!! Thanks!

Solr version: 4.0.0.2012.08.06.22.50.47


回答1:


This is a bug in DataImportHandler and it is fixed for (yet to be released) Solr 4.1. See the JIRA issue you opened on this .



来源:https://stackoverflow.com/questions/12412040/solr-dataimporthandler-when-attempting-to-use-column-values-as-field-names-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!