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

     

  • 相关阅读:
    CSS input
    CSS 伪类选择器
    input placeholder 文字颜色修改
    css flex弹性布局学习总结
    jqGrid使用方法
    GridView控件RowDataBound事件的一个实例
    GridView控件RowDataBound事件中获取列字段值的几种途径 !!!
    .net中ckeditor的应用
    博客第一天
    用python实现数学多元数学方程式计算
  • 原文地址:https://www.cnblogs.com/Zhong-Xin/p/5623257.html
Copyright © 2020-2023  润新知