简体   繁体   中英

Data import from csv file to Solr core using DIH

I am trying to upload a csv file content to SOLR using DIH(date import handler). I have wrote custom data config file and included that in solr-config.xml. Content of data config file is as shown below:

<dataConfig>
<dataSource name="ds1" type="FileDataSource" encoding="UTF-8"/>
<document>
<entity name="entryline"
                    processor="LineEntityProcessor"
                    url="testSolr.csv"
                    rootEntity="false"
                    dataSource="ds1" header="true"
                    separator="^" transformer="DateFormatTransformer" loglevel="debug">
    <field column="id" name="id"/>
    <field column="ab" name="ab"/>
    <field column="bc" name="bc"/>
    <field column="tt" name="tt" dateTimeFormat="EEE MMM dd HH:mm:ss yyyy" locale="en"/>
</entity>
</document>
</dataConfig>

The problem here is, Solr was able to fetch all the lines from csv but not able to add/update those lines to its core (Please note that i also have schema.xml with above mentioned attributes). Below is the snapshot of solr dashboard after executing the import command:

Solr dashboard snapshot after executing import command :

在此输入图像描述

I am not getting any exception either.Could anybody help me to understand the issue or provide a solution for the same. Thanks in advance.

Use baseDir in entity.

 <dataConfig> <dataSource type="FileDataSource"/> <document> <!-- this outer processor generates a list of files satisfying the conditions specified in the attributes --> <entity name="f" processor="FileListEntityProcessor" fileName="SoapHeader_.*|atom.xml$" recursive="true" rootEntity="false" dataSource="null" baseDir="D:\\Apache\\Apache-Solr-5.1\\example\\exampledocs"> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM