在配置增量更新时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}'"