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自己导入。

     

  • 相关阅读:
    17款加速效率的CSS工具
    我为什么向后端工程师推荐Node.js
    八款开源 Android 游戏引擎 (巨好的资源)
    50个必备的实用jQuery代码段
    $.getJSON()跨域请求
    javascript獲得服務器端控件的ID
    (转)8款在线CSS优化工具/组织和压缩CSS
    10 个文件和文档的比较工具
    40个有创意的jQuery图片和内容滑动及弹出插件收藏集之四
    MBP换硬盘的过程
  • 原文地址:https://www.cnblogs.com/Zhong-Xin/p/5623257.html
Copyright © 2011-2022 走看看