2017-09-27 72 views
0

我是Apache Solr搜索技术的新手,希望了解如何为某个文件夹下的多个PDF文件建立索引。Apache Solr - 索引具有特定页码的PDF文件的文件夹

目前我已经在单独的服务器上安装了Solr 6.6.1。它按预期正常工作。

请将我重定向到一些文章或教程有一些步骤来实现这件事。我想在文件夹下的所有PDF文件中搜索一些文本文字,而不指定文件名。例如,文本搜索应该发生在特定页面号上的所有文件夹文件中。

例如,我想在第5页的文件夹下的所有PDF文件中搜索单词“Partner”。

回答

0

最后,我在阅读了Apache Solr站点的文档以及它的简单方法之后找到了方法。最好和更简单的方法是使用“数据导入处理程序”的方式。配置文件的名称是data-config.xml

<dataConfig> 
    <dataSource type="BinFileDataSource"/> <!--Local filesystem--> 
    <document> 
    <entity name="K1FileEntity" processor="FileListEntityProcessor" dataSource="null" 
      baseDir="C:/solr-6.6.1/server/solr/core_myfiles_Depot/Depot" fileName=".*pdf" rootEntity="false"> 

      <field column="file" name="id"/> 
      <field column="fileAbsolutePath" name="path" /> 
      <field column="fileSize" name="size" /> 
      <field column="fileLastModified" name="lastmodified" /> 

       <entity name="pdf" processor="TikaEntityProcessor" onError="skip" 
         url="${K1FileEntity.fileAbsolutePath}" format="text"> 

       <field column="Author" name="author" meta="true"/> 
       <!-- in the original PDF, the Author meta-field name is upper-cased, 
        but in Solr schema it is lower-cased --> 

       <field column="title" name="title" meta="true"/> 
       <field column="dc:format" name="format" meta="true"/> 
       <field column="text" name="text"/> 

       </entity> 
    </entity> 
    </document> 
</dataConfig>