多值字段仅保留第一个结果

多值字段仅保留第一个结果

本文介绍了Solr - DataImportHandler:尝试将列值用作字段名称时,多值字段仅保留第一个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用类似于以下内容的文档配置执行完全导入:

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>



假设来自parent.ID的child_table的字段/值结果= 1看起来像这样:


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

fieldA和fieldB的架构配置(注意fieldB是多值的):

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" />

运行完全导入后,父1的文档如下所示:

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

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

但是,我需要(并且期待)它看起来像这样(fieldB应该有多个)价值):

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

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



任何帮助将不胜感激!!谢谢!



Solr版本:4.0.0.2012.08.06.22.50.47


Any help would be greatly appreciated!! Thanks!

Solr version: 4.0.0.2012.08.06.22.50.47

推荐答案

这是DataImportHandler中的一个错误,它固定为(尚未发布)Solr 4.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 .

这篇关于Solr - DataImportHandler:尝试将列值用作字段名称时,多值字段仅保留第一个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 18:44