2015-04-17 101 views
0

当我做数据导入时,它只索引一个文档,即使我在文件夹中有很多文件。solr tika数据导入不正常

solrconfig.xml中

<requestHandler name="/dataimport" class="solr.DataImportHandler"> 
    <lst name="defaults"> 
     <str name="config">tika-data-config.xml</str> 
    </lst> 
    </requestHandler> 

Schema.xml的

<field name="id" type="string" indexed="true" stored="true" multiValued="false" /> 
    <field name="fileName" type="string" indexed="true" stored="true" /> 
    <field name="author" type="string" indexed="true" stored="true" /> 
    <field name="title" type="string" indexed="true" stored="true" /> 

    <field name="size" type="long" indexed="true" stored="true" /> 
    <field name="lastModified" type="tdate" indexed="true" stored="true" /> 
    <field name="text" type="text_general" indexed="true" stored="true" multiValued="true"/> 

蒂卡数据-config.xml中

<dataConfig> 
    <dataSource type="BinFileDataSource" /> 
    <document> 
      <entity name="files" dataSource="null" rootEntity="false" 
      processor="FileListEntityProcessor" 
      baseDir="C:\Users\vellianm\Documents\BBRC\SearchEngine\solr-5.0.0\example\exampledocs\Process_documents\6.SCIM" fileName=".*\.(pdf)|(PDF)" 
      onError="skip" 
      recursive="true"> 
       <field column="fileAbsolutePath" name="id" /> 
       <field column="fileSize" name="size" /> 
       <field column="fileLastModified" name="lastModified" /> 
       <entity 
        name="documentImport" 
        processor="TikaEntityProcessor" 
        url="${files.fileAbsolutePath}" 
        format="text"> 
        <field column="file" name="fileName"/> 
        <field column="Author" name="author" meta="true"/> 
        <field column="title" name="title" meta="true"/> 
        <field column="text" name="text"/> 
       </entity> 
     </entity> 
    </document> 
</dataConfig> 

和时我点击dataimport获取成功消息,如下所述。

最后更新:15:56:02索引完成。新增/更新:1个文件。 已删除0个文档。请求:0,所提取的:33,跳过:0,耗时: 1发起者:约6小时前

这里所取出的文件33,但处理的是唯一的一个。另外我无法找到日志文件中的任何错误。

INFO - 2015-04-17 09:53:48.957; org.apache.solr.handler.dataimport.DataImporter; Starting Full Import 
INFO - 2015-04-17 09:53:48.959; org.apache.solr.core.SolrCore; [tika] webapp=/solr path=/dataimport params={indent=true&command=status&_=1429264428957&wt=json} status=0 QTime=0 
INFO - 2015-04-17 09:53:48.962; org.apache.solr.handler.dataimport.SimplePropertiesWriter; Read dataimport.properties 
INFO - 2015-04-17 09:53:48.978; org.apache.solr.update.DirectUpdateHandler2; [tika] REMOVING ALL DOCUMENTS FROM INDEX 
INFO - 2015-04-17 09:53:49.124; org.apache.solr.handler.dataimport.DocBuilder; Import completed successfully 
+1

转到Solr管理,然后日志。启用调试模式。再次运行导入程序,您应该会看到更多信息。我希望这会帮助你更多。 – ameertawfik

+0

谢谢ameertawfik。我已启用并检查,但dataimporter没有错误。 – Mohan

回答

1

这个工作对我来说:

<dataConfig> 
<dataSource type="BinFileDataSource" /> 
    <document> 
     <entity name="files" dataSource="null" rootEntity="false" 
     processor="FileListEntityProcessor"      
     baseDir="/tmp/docs" 
     fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)|(docx)|(ppt)" 
     onError="skip" 
     recursive="true"> 

      <field column="fileAbsolutePath" name="path" /> 
      <field column="fileSize" name="size" /> 
      <field column="fileLastModified" name="lastModified" /> 

      <entity 
       name="documentImport" 
       processor="TikaEntityProcessor" 
       url="${files.fileAbsolutePath}" 
       format="text"> 
       <field column="file" name="fileName"/> 
       <field column="Author" name="author" meta="true"/> 
       <field column="title" name="title" meta="true"/> 
       <field column="text" name="text"/> 
       <field column="fileAbsolutePath" name="path" /> 
       <field column="fileSize" name="size" /> 
       <field column="fileLastModified" name="lastmodified" />      
       <field column="LastModifiedBy" name="LastModifiedBy" meta="true"/> 
      </entity> 
    </entity> 
    </document> 
</dataConfig> 

注基线目录...的报价是相反

+2

检查我的翻译从您的原始葡萄牙语。 (?)如果需要进一步说明,你应该在英语中编辑答案。 – Mogsdad