Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search multiple SOLR core's and return one result set

Tags:

solr

We have several core's setup in SOLR and would like to search across these cores and return a single result set.

A bit more background: We have a SOLR core that we index our internal blog engine. We also have a SOLR core that we index our CMS system. We would like to search across both of these cores but view a single result set.

I am aware of having related entities in a document, but we would like to keep the cores separate, for easy of maintenance, and redundancy.

We are using SolrSharp as a wrapper for searching SOLR. Any advice or direction would be appreciated.

like image 253
Rihan Meij Avatar asked Jan 26 '10 11:01

Rihan Meij


3 Answers

Since Solr 1.3, there's been decent multi-core search capabilities in Solr. Please read the Distributed Search article where it explains how to use the shards parameter to query across multiple cores and return results as one data set.

like image 194
Brian Avatar answered Sep 22 '22 09:09

Brian


There is no way to execute a single query across multiple cores. The Distributed Search mentioned in another answer is to do with shards which is splitting indexes across systems.

In fact, multiple cores are really for storing separate and different structures in each and querying multiple cores shouldn't make sense. As some have mentioned in previous comments, you can have an additional core which holds all your fields - though you may have to rename the fields in this new core so that similar named but differently typed fields can both be stored.

like image 35
Matthew Wilcoxson Avatar answered Sep 21 '22 09:09

Matthew Wilcoxson


Mathew's answer is exactly right. Shards and multi-cores are apples and oranges. You cannot have a unified single query across multiple cores. You have to perform individual queries per core (http://localhost:8983/solr/core0/select?q=: ,http://localhost:8983/solr/core1/select?q=:). With shards however, (http://localhost:8983/solr/select?shards=localhost:8983/solr,localhost:8984/solr&q=:).

like image 22
Morris Avatar answered Sep 22 '22 09:09

Morris