Merging index with SolR 1.4

谁说胖子不能爱 提交于 2020-01-07 04:40:31

问题


I'm working with Solr 1.4, and I want to test mergeindexes.

Imagine these following Cores (A and B) :

http://img59.imageshack.us/img59/5804/coreaandb.png

In the core "A", there are document that have the same id than in core B.

I want to merge these two core into a core C. The goal is to get a core C which contains merged documents (based on id).

For example, I want to get the following document into the core C :

  • id : 1
  • title : rambo
  • tag : super

If I call the mergeindexes method, I get the following core C :

http://localhost:8080/solr/admin/multicore?action=mergeindexes&core=coreC&indexDir=../../coreA/data/index&indexDir=../../coreB/data/index

http://img440.imageshack.us/img440/6818/coremerged.png

Do you know if it's possible to get merged documents ?

Thanks for your help,

Antoine


回答1:


You could do this client-side using SolrJ or whatever client platform you prefer.

Pseudocode:

while documents in core B:
  let docsB = docb1, docb2, ..., docb10 = fetch 10 documents from core B
  let docsA = fetch documents from core A where id:docb1 OR id:docb2 OR ... id:docb10
  for db,da in zip(docsB, docsA):
    let docC = merge(db,da)
    add docC to Solr core C


来源:https://stackoverflow.com/questions/4343574/merging-index-with-solr-1-4

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