Merging index with SolR 1.4

2019-08-30 02:23发布

问题:

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


标签: merge solr