您的位置:首页 > 其它

solr增量更新的字段

2015-07-31 14:40 260 查看
在配置增量更新时MySQL表里要有一个字段,update_time能让solr找到那些行是新增的,在配置文件里的SQL要加上条件where update_time > '${dih.last_index_time}'"

update_time字段要是date类型,但是我们在设计表的时间该字段是long的时间戳。所以当我在进行增量更新时,被更新的总是全量。所以要把long类型转换成date类型才能和'${dih.last_index_time}'"做比较。对应的修改如下:

query="select id,words,coordinate,status,utime from solr_index_task"

    deltaImportQuery="select id,words,coordinate,status,utime from solr_index_task where id='${dih.delta.id}'"

    deltaQuery="select id from solr_index_task where
FROM_UNIXTIME(left(utime,10),'%Y-%m-%d %H:%i:%s')>'${dih.last_index_time}'"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: