1. 创建本地目录

$ mkdir /usr/local/contentplatform/solr/solr/core1/file1
$ ls -lh
total 88M
-rw-r--r-- tnuser appuser 14M May : apache_hbase_reference_guide.pdf
-rw-r--r-- tnuser appuser 7.4M Apr : Architecting_HBase_Applications.pdf
-rw-r--r-- tnuser appuser 14M Jan Cloudera_Hadoop_Test_Cases.docx
-rw-r--r-- tnuser appuser 6.6M Apr : HBase_Administration_Cookbook.pdf
-rw-r--r-- tnuser appuser 2.1M Apr : HBase_Essentials.pdf
-rw-r--r-- tnuser appuser 25M Apr : Hbase-HBase实战.pdf
-rw-r--r-- tnuser appuser 7.9M Nov HBase.in.Action.pdf
-rw-r--r-- tnuser appuser 13M Apr : HBase:The_Definitive_Guide.pdf

2. 在core的conf目录修改配置文件solrconfig.xml配置dataimport请求处理器

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>

3. 在conf目录新建data-config.xml文件并添加数据源的引用

<dataConfig>
<dataSource name="fileDataSource" type="fileDataSource" />
<dataSource name="binFileDataSource" type="BinFileDataSource" />
<document>
<entity
name="file1"
datasource="fileDataSource"
processor="FileListEntityProcessor"
baseDir="/usr/local/contentplatform/solr/solr/core1/file1"
fileName=".*\.(pdf)|(doc)|(docx)|(ppt)|(pptx)|(xls)|(xlsx)|(odf)|(txt)|(rtf)|(html)|(htm)|(jpg)|(csv)"
onError="skip"
recursive="true"
rootEntity="false">
<field column="file" name="id" />
<field column="fileSize" name="size" />
<field column="fileAbsolutePath" name="filepath" />
<field column="fileLastModified" name="lastModified" /> <entity
name="documentImport1"
processor="TikaEntityProcessor"
url="${file1.fileAbsolutePath}"
format="text"
datasource="binFileDataSource"
onError="skip"
recursive="true">
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
<field column="text" name="text"/>
</entity>
</entity>
</document>
</dataConfig>

4.修改conf目录下的schema.xml文件,添加以下内容

   <field name="fileLastModified" type="date" indexed="true" stored="true"/>
<field name="fileAbsolutePath" type="string" indexed="true" stored="true"/>

5. 重新加载配置文件

6. 通过DIH导入本地的文件

6. 查看导入的文档

{
"responseHeader": {
"status": ,
"QTime": ,
"params": {
"indent": "true",
"q": "*:*",
"_": "",
"wt": "json"
}
},
"response": {
"numFound": ,
"start": ,
"docs": [
{
"id": "Hbase-HBase实战.pdf",
"title": [
"HBASE 实战=HBASE IN ACTION"
],
"author": "(美)NICK DIMIDUK著;谢磊译",
"author_s": "(美)NICK DIMIDUK著;谢磊译",
"_version_":
},
{
"id": "apache_hbase_reference_guide.pdf",
"title": [
"Apache HBase ™ Reference Guide"
],
"author": "Apache HBase Team",
"author_s": "Apache HBase Team",
"_version_":
},
{
"id": "Architecting_HBase_Applications.pdf",
"title": [
"Architecting HBase Applications"
],
"author": "Jean-Marc Spaggiari & Kevin O'Dell",
"author_s": "Jean-Marc Spaggiari & Kevin O'Dell",
"_version_":
},
{
"id": "HBase_Administration_Cookbook.pdf",
"_version_":
},
{
"id": "HBase_Essentials.pdf",
"title": [
""
],
"author": "",
"author_s": "",
"_version_":
},
{
"id": "HBase.in.Action.pdf",
"title": [
"HBase in Action"
],
"author": "Nick Dimiduk, Amandeep Khurana",
"author_s": "Nick Dimiduk, Amandeep Khurana",
"_version_":
},
{
"id": "HBase:The_Definitive_Guide.pdf",
"title": [
"HBase: The Definitive Guide"
],
"author": "Lars George",
"author_s": "Lars George",
"_version_":
},
{
"id": "Cloudera_Hadoop_Test_Cases.docx",
"author": "FeiLong, Li [DBA]",
"author_s": "FeiLong, Li [DBA]",
"_version_":
}
]
}
}

Solr 4.4.0利用dataimporthandler导入本地pdf、word等文档的更多相关文章

  1. Solr 4.4.0利用dataimporthandler导入postgresql数据库表

    将数据库edbstore的edbtore schema下的customers表导入到solr 1. 首先查看customers表字段信息 edbstore=> \d customers Tabl ...

  2. 【工具篇】利用DBExportDoc V1.0 For MySQL自动生成数据库表结构文档

    对于DBA或开发来说,如何规范化你的数据库表结构文档是灰常之重要的一件事情.但是当你的库,你的表排山倒海滴多的时候,你就会很头疼了. 推荐一款工具DBExportDoc V1.0 For MySQL( ...

  3. 利用DBExportDoc V1.0 For MySQL自动生成数据库表结构文档

    对于DBA或开发来说,如何规范化你的数据库表结构文档是灰常之重要的一件事情.但是当你的库,你的表排山倒海滴多的时候,你就会很头疼了. 推荐一款工具DBExportDoc V1.0 For MySQL( ...

  4. idea导入项目报错:文档中根元素前面的标记必须格式正确

    今天从git上面导入项目之后,由于是上周刚刚提交过的,本地也没有什么修改,于是就从gitlab上面直接下载下来了.可是项目启动时候,报错了... 文档中根元素前面的标记必须格式正确 想想 原来是上次提 ...

  5. 利用sphinx为python项目生成API文档

    sphinx可以根据python的注释生成可以查找的api文档,简单记录了下步骤 1:安装 pip install -U Sphinx 2:在需要生成文档的.py文件目录下执行sphinx-apido ...

  6. 利用Swagger2自动生成对外接口的文档

    一直以来做对外的接口文档都比较原始,基本上都是手写的文档传来传去,最近发现了一个新玩具,可以在接口上省去不少麻烦. swagger是一款方便展示的API文档框架.它可以将接口的类型最全面的展示给对方开 ...

  7. 利用node 剥取其他网站的文档数据结构 ---

    1.如何利用nodejs获取其他网站的文档结构呢 以下是代码演示------! //首先需要引入一些核心模块 var http = require('http'); var fs = require( ...

  8. Asp.Net Core2.0 WebAPI 使用Swagger生成漂亮的接口文档

    1.引用NuGet: Swashbuckle.AspNetCore.Swagger Swashbuckle.AspNetCore.SwaggerGen 或 <PackageReference I ...

  9. Confluence-6.10.0+Jira-7.13+Crowd-3.2.1最全破解文档,附下载包

    =========================================2019.4.19更改================================================ ...

随机推荐

  1. chromedriver.exe,自动化web, 安装谷歌驱动,以及可能遇到的坑

    1.下载谷歌驱动:chromedriver.exe http://chromedriver.storage.googleapis.com/index.html (下载驱动的链接) 2.把下载的chro ...

  2. python from…import* 语句

    把一个模块的所有内容全都导入到当前的命名空间也是可行的,只需使用如下声明: from modname import * 这提供了一个简单的方法来导入一个模块中的所有项目.然而这种声明不该被过多地使用. ...

  3. C# 写日志的方法

    public void WriteLog(string msg)        {            string filePath = AppDomain.CurrentDomain.BaseD ...

  4. 在对 Angular 的文档 aio 进行编译的时候提示错误

    error angular-examples-master@1.0.0: The engine "yarn" is incompatible with this module. E ...

  5. 「TJOI2019」大中锋的游乐场

    题目链接 问题分析 比较明显的最短路模型.需要堆优化的dij.建图的时候注意细节就好. 参考程序 #include <bits/stdc++.h> #define LL long long ...

  6. 如何将项目托管到Github上

    将本地项目放到GitHub上托管并展示 传送门 利用Github Pages展示自己的项目 传送门 git Please tell me who you are解决方法 传送门 git config ...

  7. Java内存模型之可见性问题

    本博客系列是学习并发编程过程中的记录总结.由于文章比较多,写的时间也比较散,所以我整理了个目录贴(传送门),方便查阅. 并发编程系列博客传送门 前言 之前的文章中讲到,JMM是内存模型规范在Java语 ...

  8. 【nginx】 配置域名转发到相同地址不同端口下执行相应业务

    #doctor upstream doc { server 52.**.**.***:8090; } #patient upstream pat { server 52.**.**.***:8088; ...

  9. Rust Linking With C Library Functions

    #[link(name = "c")] extern "C" { fn scanf(format: *const u8, ...); } fn main() { ...

  10. 使用DBLink方式同步远程数据库中含Blob、Clob字段表的问题解决

    在数据库同步中我们经常会用到DBLink方式.DBLink可以将物理上存放于网络的多个数据库在逻辑上当成一个单一的大数据库.开发人员无需关心数据库的网络分布,就能很方便的实现从不同数据库之间读取数据. ...