Stillmatic1985
Stillmatic1985

Reputation: 1912

Solr search in multiple collections

Iam working with Solr. My solr.xml file looks something like this.

<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="true">
  <cores defaultCoreName="test1" host="${host:}" adminPath="/admin/cores" zkClientTimeout="${zkClientTimeout:15000}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">
    <core loadOnStartup="true" instanceDir="test1/" transient="false" name="test1" collection="test1"/>
    <core loadOnStartup="true" instanceDir="test2/" transient="false" name="test2" collection="test2"/>
  </cores>
</solr>

Now, i want to search in both collections. So i want the results that hit in collection1 or in collection2.

Must i send two requests or is solr able to handle one request against 2 (or more) collections.

I could do something like this:

http://***.***.***.***:8080/solr/test1/select?q=field%3Dtest&wt=xml&indent=true
http://***.***.***.***:8080/solr/test2/select?q=field%3Dtest&wt=xml&indent=true

Upvotes: 0

Views: 3150

Answers (1)

Jayendra
Jayendra

Reputation: 52779

you can check for Solr distributed search, which will allow you to search across Collections.

However, be sure you are maintaining common fields in both the cores so that the query finds them and returns them.
Also, distributed search also has some limitations.

Else, you need to query differently and consolidate the results.

Upvotes: 1

Related Questions