solr5.0.0的使用(二)
来源:互联网 发布:帮别人 淘宝刷单 被骗 编辑:程序博客网 时间:2024/06/09 20:54
Solr提供了丰富的数据导入接口,可以导入数据库表、xml、json、csv各种格式的数据信息。
大多数的应用程序将数据存储在关系数据库、xml文件中。对这样的数据进行搜索是很常见的应用。所谓的DataImportHandler提供一种可配置的方式向solr导入数据,可以一次全部导入,也可以增量导入。他可以实现能够读取关系数据库中的数据。通过可配置的方式,能够将数据库中多列、多表的数据生成solr文档能够通过solr文档更新solr提供通过配置文件就能够导入所有数据的能力能够发现并处理 由insert、update带来的变化(我们假定在表中有一个叫做“last-modified的列”)能够配置"完全导入"和"增量导入"的时间让读取xml文件,并建立索引成为可配置。能够将 其他的数据源(例如:ftp,scp,etc)或者其他格式的文档(Json,csv)以插件的形式集成到项目中。
导入mysql数据库
配置workspace/temp_info/conf/solrconfig.xml添加
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
配置workspace/temp_info/conf/schema.xml添加
<field name="temp_id" type="string" indexed="true" stored="true" multiValued="false" />
<field name="temp_name" type="string" indexed="true" stored="true" />
<field name="temp_phone" type="string" indexed="true" stored="true" />
注释掉
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
修改
<uniqueKey>id</uniqueKey>
为
<uniqueKey>temp_id</uniqueKey>
增加文件workspace/temp_info/conf/data-config.xml文件内容为
<?xml version="1.0" encoding="utf-8"?>
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://ip:3306/test?useUnicode=true&characterEncoding=utf-8" temp="name" password="password"/>
<document >
<entity name="parteam_test_temp" pk="temp_id" query="select a.temp_id as temp_id,a.nick_name as temp_name from temp_info a">
<field column="temp_id" name="temp_id" />
<field column="temp_name" name="temp_name" />
</entity>
</document>
</dataConfig>
- solr5.0.0的使用(二)
- solr5.0.0的使用(—)
- solr5.5-post.jar的使用
- solr5.0.0生产环境的安装
- win7 64位系统下安装使用solr5.0.0
- Solr5.1.0的搭建
- Solr5.2的配置
- solr5的基本操作
- Solr5.5使用schema.xml
- solr5.4的安装配置
- solr5.3的spellcheck功能
- solr5和solr4的区别
- Windows系统下solr5.2.1的搭建 ,以及smart和ik分词器的使用
- Solr5之使用Tomcat部署Solr
- Solr5.5集群安装部署及使用
- centos 6.6 使用tomcat8部署solr5.5.3
- centos 6.6 使用tomcat6部署solr5.3.1
- solr5使用suggest模块实现搜索联想
- POJ - 2823 Sliding Window (单调队列求解区间最值)
- POJ3126 - Prime Path
- 【POJ】3040 - Allowance(贪心)
- 顺序表应用2:多余元素删除之建表算法
- iOS判断输入的字符是否都是中文
- solr5.0.0的使用(二)
- Redis HyperLogLog
- Adapter的getViewTypeCount和getItemViewType 使用
- jQuery resize 事件增强版
- solr5.0.0的使用(—)
- 微信分享菜单栏显示,隐藏
- 浪祥电站调速器被改造
- linux 一次执行多条命令
- metasploit渗透测试笔记(meterpreter篇)-补充篇