Solr copy data from “crawler” core into “search” core

倾然丶 夕夏残阳落幕 提交于 2019-12-13 05:48:08

问题


We are looking to have a Solr 4.9 setup where we have a very simple crawler wipe out and load up a "crawler" core then trigger a copy of the data over to "search" core when the crawl is done. The purpose of this is that our crawler is VERY simple, and doesn't really track documents in a way that would be conducive to doing updates and deleted. Basically, the crawler will be wiping out the entire "crawler" core, ripping though about 50k documents (committing ever 1000 or so), and then trigger something to copy over the data to the other "search" core.

Assuming we would have to restart the Search core, how could this be made possible from command-line or code?


回答1:


Create a third core as a copy of the search core. Then use the mergeindexes command in CoreAdmin to merge two different cores into the third one. After the merge finishes, swap the the third core with the old search core. Then UNLOAD the swapped out core (with deleteInstanceDir=true if you're feeling that you can permanently remove the old data).

Something like:

http://localhost:8983/solr/admin/cores/action=CREATE&name=core0&instanceDir=path_to_instance_directory&config=config_file_name.xml&schema=schema_file_name.xml&dataDir=data

http://localhost:8983/solr/admin/cores?action=mergeindexes&core=core0&indexDir=/opt/solr/crawl/data/index&indexDir=/opt/solr/index/data/index

http://localhost:8983/solr/admin/cores?action=SWAP&core=search&other=core0

http://localhost:8983/solr/admin/cores?action=UNLOAD&core=core0


来源:https://stackoverflow.com/questions/25492804/solr-copy-data-from-crawler-core-into-search-core

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!