solr导入mysql时间类型_solr4.5笔记(三)—— solr导入mysql数据

这里修改core1来实现mysql的数据导入(所需jar第一篇文章已经加过了),这里只是示例具体请根据自己的需要稍微改一下

PS:如果修改core1库的名字 换为 test,需要把solrconfig.xml里面的${solr.core1.data.dir:} 全部改为${solr.test.data.dir:}

1、修改solrconfig.xml

0818b9ca8b590ca3270a3433284dd417.png

添加如下:

data-config.xml

在同一目录下新建一个data-config.xml

url="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8" user="root"

password="root"/>

query="select id,slogan,companyName,categoryId,categoryName,xcategoryName,xcategoryId,regtime,invest,shopNum,url,brandName,product,managementMode,level,logo,createDate from company_basicinfo where isDelete=0 and isActive=1"

deltaImportQuery="select id,slogan,companyName,categoryId,categoryName,xcategoryName,xcategoryId,regtime,invest,shopNum,url,brandName,product,managementMode,level,logo,createDate from company_basicinfo where isDelete=0 and isActive=1 and id='${dataimporter.delta.id}'"

deltaQuery="select id from company_basicinfo where isDelete=0 and isActive=1 and updateDate > '${dataimporter.last_index_time}'">

修改schema.xml

id

companyName

重启solr使配置生效

打开

导入数据可以看到 跟data-config.xml的配置是对应的

0818b9ca8b590ca3270a3433284dd417.png

导入完成后查看一下数据 和是否分词

0818b9ca8b590ca3270a3433284dd417.png

查看分词结果 在schema.xml配置文件中 只指定了companyName、brandName、product进行分词(type指定)所以只看这几个词的分词结果

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

到此导入mysql数据已经结束

http://www.iteye.com/topic/759148

下一篇记录定时跟新索引文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值