zoukankan      html  css  js  c++  java
  • solr 5.3 提取pdf数据创建索引

    solr-data-conofig.xml

    <dataConfig>
    <script><![CDATA[
    id = 1;
    function GenerateId(row) {
    row.put('id', (id ++).toFixed());
    return row;
    }
    ]]></script>
    <dataSource type="BinFileDataSource" />
    <document >
    <entity name="files" dataSource="binary" rootEntity="false"
    processor="FileListEntityProcessor"
    baseDir="D:/temp/temp" fileName=".*.(doc)|(pdf)|(xls)|(ppt)|(docx)"
    recursive="true" transformer="script:GenerateId">
    <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="file"/>
    <field column="Author" name="author" meta="true"/>
    <field column="title" name="title" meta="true"/>
    <field column="text" name="content"/>
    </entity>
    </entity>
    </document>
    </dataConfig>

    scheam.xml


    <field name="id" type="string" indexed="true" stored="true" multiValued="false" />
    <field name="size" type="string" indexed="true" stored="true" multiValued="false" />
    <field name="lastModified" type="date" indexed="true" stored="true" multiValued="false" />
    <field name="path" type="string" indexed="true" stored="true" multiValued="false" />

    <field name="file" type="string" indexed="true" stored="true" multiValued="false" />

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

    主要的配置文件就这两个,其中需要一些jar包 如tika-paser自己导入。

     

  • 相关阅读:
    SQL使用基本准则
    SQL使用技巧-或许你不知道的10条SQL技巧
    RabbitMQ安装遇到的坑
    编译安装python
    批量化杀死进程
    python中[-1]、[:-1]、[::-1]、[n::-1]使用方法
    c++中 . 和 -> 的区别是什么?
    C语言中的malloc、new、memset函数解析
    C语言中static关键字用法
    struct和typedef struct的区别
  • 原文地址:https://www.cnblogs.com/Zhong-Xin/p/5623257.html
Copyright © 2011-2022 走看看