How to Search Multiple SOLR Core?

2019-05-19 03:25发布

问题:

In Single Solr Instance, multiple core(s) are there. No Shards, Replication and Cloud concept involved. Now how to search over multiple core in this scenario?

回答1:

To search across cores, you'll have to use sharding. If the schema for both cores are identical, you can just query one core and provide the shards parameter.

If the schema is different, create a separate core that have a merged schema of both the target schemas, then query that core with the two separate cores as shards. Having FieldA, FieldB in core0 and FieldB, FieldC in core1 would require a schema with FieldA, FieldB, FieldC defined, and then a shards parameter that points to core0 and core1.

The primary issue with this approach is that if the documents are very different, scoring between them might be a bit weird, as comparing something from core0 with something from core1 can be strange.

Sharding also assumes that the documents are distributed evenly (as the scores are calculated locally on each core).