1、将solr-5.0.0_安装包.tgz解压。(解压命令:tar -zxvf solr-5.0.0.tgz )
solr搭建
http://blog.youkuaiyun.com/freedomboy319/article/details/44095875
solr 分词
http://blog.youkuaiyun.com/freedomboy319/article/details/44097215
相关配置见代码:
数据库索引配置
http://www.cnblogs.com/luxiaoxun/p/4442770.html
增量建立索引
https://yq.aliyun.com/articles/50467
http://my.oschina.net/scottCoder/blog/640653?p={{currentPage%201}}
http://www.mamicode.com/info-detail-1150757.html
多列,实现对象包含对象:
http://blog.youkuaiyun.com/zl3450341/article/details/12849341
<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://192.168.10.10:3307/user" user="root" password="12345" batchSize="-1" />
<document name="testDoc">
<entity name="subjectList" pk="id"
query="select * from subject where status=1"
<!---增量索引及修改索引->
deltaQuery="select id from subject where updated_at > '${dataimporter.last_index_time}'"
deltaImportQuery="select * from subject where id= '${dih.delta.id}'">
<!---删除索引-->
<span class="attribute" style="background-repeat: no-repeat; margin: 0px; padding: 0px; color: rgb(0, 128, 128); font-family: monospace; white-space: pre;">deletedPkQuery</span><span style="color: rgb(0, 0, 128); font-family: monospace; white-space: pre;">=</span><span class="value" style="background-repeat: no-repeat; margin: 0px; padding: 0px; color: rgb(221, 17, 68); font-family: monospace; white-space: pre;">"select * from subject where status=0"</span><span style="color: rgb(0, 0, 128); font-family: monospace; white-space: pre;"> </span>
<field column="id" name="id"/>
<field column="uniq_id" name="uniqId"/>
<field column="name" name="name"/>
<field column="name_us" name="nameUs"/>
<field column="sort" name="sort"/>
<field column="display_in_us" name="displayInUs"/>
<field column="status" name="status"/>
<field column="updated_at" name="updatedAt"/>
<field column="created_at" name="createdAt"/>
</entity>
</document>
</dataConfig>
在查询的sql中,其中的一个字段存储一个对象可以这么编辑:
<entity name="imgUrlAndType"
query="select CONCAT(type,':',(select CONCAT('http://',ip) from storage_server),'/',ci.img_url) imgUrl from course_image ci where ci.region_type =1 and course_id ='${courseList.uniqId}'">
<field column="imgUrl" name="imgUrl"/>
</entity>
<field name="imgUrl" type="string" indexed="true" stored="true" multiValued="true" />
配置数据库时时更新内容(如果有更改更新索引)
solr-5.0.0/server/solr/conf
目录下的
dataimport.properties