搜档网
当前位置:搜档网 › solr配置方式+url发送格式

solr配置方式+url发送格式

一、删除索引方式:
1、数据库中有删除标记的使用deletedPkQuery="select ID from delete where isdelete=1"
2、数据库中没有删除标记的使用删除触发器发生url同步更新索引
二、全量索引
1、可以使用solrj的api实现全量索引更新
2、可以使用solr管理页面手动更新
三、增量索引
1、使用solrj的api实现增量索引
2、使用触发器+存储过程实现同步更新索引
http://localhost:8081/solr/my_core/update?stream.body=%3Cdelete%3E%3Cid%3E'+@id+'%3C/id%3E%3C/delete%3E&stream.contentType=text/xml;charset=utf-8&commit=true


url清单:
String detalUrl = "http://localhost:8081/solr/my_core/dataimport?command=delta-import&clean=false&commit=true";
String fullUrl = "http://localhost:8081/solr/my_core/dataimport?command=full-import&clean=false&commit=true";
String deleteUrl = "http://localhost:8081/solr/my_core/update?stream.body=%3Cdelete%3E%3Cid%3E'+@id+'%3C/id%3E%3C/delete%3E&stream.contentType=text/xml;charset=utf-8&commit=true";



配置说明
//增量索引根据createTime字段时间更新
1,deltaQuery="select id from enterprise where createTime > '${https://www.sodocs.net/doc/5618458777.html,st_index_time}' "

//增量索引查询出要删除的id批量删除
2,deletedPkQuery="select id from enterprise where isdelete='1'"

以上两种都使用url=detalUrl更新索引
全量更新配置
3,query="SELECT id,enName,enUser,enDesc,dateadd(hour,8,cast(createTime as datetime)) createTime FROM enterprise"

相关主题