solr通过http请求的方式实现全量增量同步数据库
通过http请求即可
全量发送
http://localhost:8983/solr/core1/dataimport?command=full-import&clean=false&commit=true
增量发送
http://localhost:8983/solr/core1/dataimport?command=delta-import&clean=false&commit=true
即可
前提是配置正确
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/ygtest" user="root" password="root"/>
<document>
<entity name="data"
query="SELECT * from tb_item"
deltaImportQuery="select * from tb_item where id='${dih.delta.id}'"
deltaQuery="select id from tb_item where create_time > '${dih.last_index_time}'"
transformer="RegexTransformer">
<field column="id" name="id" />
<field column="title" name="item_title" />
<field column="sell_point" name="item_sell_point" />
<field column="price" name="item_price" />
<field column="num" name="item_num" />
<field column="status" name="item_status" />
</entity>
</document>
</dataConfig>
详细文档https://download.****.net/download/weixin_41796956/11189995