简体   繁体   English

使用DIH将数据从csv文件导入到Solr核心

[英]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). 我正在尝试使用DIH(日期导入处理程序)将CSV文件内容上传到SOLR。 I have wrote custom data config file and included that in solr-config.xml. 我已经编写了定制数据配置文件,并将其包含在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). 这里的问题是,Solr能够从csv中获取所有行,但无法将这些行添加/更新到其核心(请注意,我也具有带有上述属性的schema.xml)。 Below is the snapshot of solr dashboard after executing the import command: 下面是执行导入命令后的solr仪表盘的快照:

Solr dashboard snapshot after executing import command : 执行导入命令后,Solr仪表板快照:

在此输入图像描述

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. 在实体中使用baseDir。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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