Solr DIH regextransformer语言 - 仅处理一行CSV行



嗨,我有以下 CSV 文件

132 1536130302256087040
133 1536130302256087041
134 1536130302256087042

这些字段由选项卡分隔。现在我有了 solr 的数据导入处理程序 (DIH),我尝试将 CSV 导入 solr,但我只将第一行导入 solr。这就是结果,但缺少 CSV 中的其他行:

  "response": {
    "numFound": 1,
    "start": 0,
    "maxScore": 1,
    "docs": [ {
        "string": "1536130302256087040",
        "id": "132",
        "_version_": 1536202153221161000
      } ] }

这是我的数据配置.xml

<dataConfig>
<dataSource type="FileDataSource" encoding="UTF-8" name="fds"/>
    <document>
     <entity name="f" 
     processor="FileListEntityProcessor" 
     fileName="myfile.csv" 
     baseDir="/var/www/solr-5.4.0/server/csv/files" 
     recursive="false" 
     rootEntity="true" 
     dataSource="null" >
     <entity 
     onError="continue" 
     name="jc"   
     processor="LineEntityProcessor" 
     url="${f.fileAbsolutePath}" 
     dataSource="fds"  
     rootEntity="true" 
     header="false"
     separator="t"
     transformer="RegexTransformer" >
     <field column="id" name="id" sourceColName="rawLine" regex="^(.*)t"/>
     <field column="string" name="string" sourceColName="rawLine" regex="t(.*)$"/>
             </entity>            
        </entity>
    </document>
</dataConfig>

这是我的架构.xml

<field name="id" type="text_general" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="string" type="text_general" indexed="true" stored="true" multiValued="false"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
 <uniqueKey>id</uniqueKey>

我做错了什么?

对于

两个级别的实体,您都有 rootEntity=true。因此,您只会获得外部实体的一个文档。尝试将外部级别根实体设置为 false。

此外,您只需将制表符分隔的文件发送到带有CSV处理器的Solr,无需DIH。

最新更新