日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

solr增量索引

發布時間:2025/3/17 编程问答 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 solr增量索引 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參考:http://wiki.apache.org/solr/DataImportHandler#Using_delta-import_command

修改qiye-data-config.xml

<dataConfig><dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"url="jdbc:mysql://localhost:3306/qiye"user="root" password="root"/><document><entity name="id" pk="id"query="select id,shopdesc from testshop"deltaImportQuery="select * from testshop where ID='${dih.delta.id}'"deltaQuery="select id from testshop where last_modified &gt; '${dih.last_index_time}'"></entity></document> </dataConfig>

表中testshop加入了字段last_modified 為timestamp類型,默認CURRENT_TIMESTAMP

The query gives the data needed to populate fields of the Solr document in full-import The deltaImportQuery gives the data needed to populate fields when running a delta-import The deltaQuery gives the primary keys of the current entity which have changes since the last index time The parentDeltaQuery uses the changed rows of the current table (fetched with deltaQuery) to give the changed rows in the parent table.This is necessary because whenever a row in the child table changes, we need to re-generate the document which has that field.

運行:

http://localhost:8080/solr/dataimport?command=delta-import?導入新加入的數據,

http://localhost:8080/solr/#/collection1/query?就可以查詢出剛才新加入的數據

關于定時索引,查看文檔http://wiki.apache.org/solr/DataImportHandler#Scheduling

這里也發現了有人對這個進行了封裝:https://code.google.com/p/solr-dataimport-scheduler/

轉載于:https://www.cnblogs.com/atyou/archive/2013/04/20/3032895.html

總結

以上是生活随笔為你收集整理的solr增量索引的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。