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

StackOverflow https://stackoverflow.com/questions/12412040

Вопрос

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

Это было полезно?

Решение

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 .

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top