Solr 使用DataImportHandler的单个实体中有多个转换器

Solr 使用DataImportHandler的单个实体中有多个转换器,solr,dataimporthandler,Solr,Dataimporthandler,我正在使用DataImportHandler对Solr中的数据进行索引 我正在从数据库中的自动表中的三列中检索数据,其中两列(即主题和部分)的数据类型为“CLOB”,列日期具有保存创建日期的oracle时间戳 问题是在我的数据配置文件中,我需要将clob数据转换为字符串,并将日期转换为Solr使用的UTC 所以我需要两个变压器,即ClobTransformer和DateTransformer 我想知道如何在单个实体中使用这两个变压器 这是我的数据配置文件 <dataConfig>

我正在使用DataImportHandler对Solr中的数据进行索引

我正在从数据库中的自动表中的三列中检索数据,其中两列(即主题和部分)的数据类型为“CLOB”,列日期具有保存创建日期的oracle时间戳

问题是在我的数据配置文件中,我需要将clob数据转换为字符串,并将日期转换为Solr使用的UTC

所以我需要两个变压器,即ClobTransformer和DateTransformer

我想知道如何在单个实体中使用这两个变压器

这是我的数据配置文件

<dataConfig>
    <dataSource name="ds1" type="JdbcDataSource"
    driver="oracle.jdbc.OracleDriver"
    url="....."
    user="....."
    password="...."/>
    <document name="doc">
        <entity name="ent" 
                query="Select 
                            auto.ID,
                            auto.Topic as Topic,
                            auto.Parts as Parts,
                            to_date(to_char(auto.Date, 'yyyy-MM-dd HH:MI:SS'), 'YYYY-MM-DD HH:MI:SS') AS Date,
                        From auto 
                        order by auto.Date DESC" 
                dataSource="ds1" transformer="DateFormatTransformer">
            <field column="ID" name="id"/>
            <field column="TOPIC" name="topic" clob="true"/>
            <field column="PARTS" name="parts" clob="true"/>
            <field column="DATE" name="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd HH:mm:ss" locale="en"/>
        </entity>
    </document>
</dataConfig>

上面我只使用了DateFormatTransformer


任何帮助都将不胜感激。

好的,我知道它是如何完成的。只需在标记的“transformer”部分使用逗号指定特定的transformer,如下所示:

<dataConfig>
    <dataSource name="ds1" type="JdbcDataSource"
    driver="oracle.jdbc.OracleDriver"
    url="....."
    user="....."
    password="...."/>
    <document name="doc">
        <entity name="ent" 
                query="Select 
                            auto.ID,
                            auto.Topic as Topic,
                            auto.Parts as Parts,
                            to_date(to_char(auto.Date, 'yyyy-MM-dd HH:MI:SS'), 'YYYY-MM-DD HH:MI:SS') AS Date,
                        From auto 
                        order by auto.Date DESC" 
                dataSource="ds1" transformer="ClobTransformer,DateFormatTransformer">
            <field column="ID" name="id"/>
            <field column="TOPIC" name="topic" clob="true"/>
            <field column="PARTS" name="parts" clob="true"/>
            <field column="DATE" name="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd HH:mm:ss" locale="en"/>
        </entity>
    </document>
</dataConfig>

我使用了两个变压器,
transformer=“ClobTransformer,DateFormatTransformer”