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

     

  • 相关阅读:
    使用contentProvider
    创建Sqlite数据库(一)
    AIDL实现进程间通信
    Messenger实现进程间通信(IPC)
    Serializable使用
    Parcelable使用(二)
    STAR法则
    Python系列-------基本语法
    前端随心记---------面试题集
    前端随心记---------惟客科技面试
  • 原文地址:https://www.cnblogs.com/Zhong-Xin/p/5623257.html
Copyright © 2011-2022 走看看