Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating collections in SOLR

Tags:

java

solr

solrj

On the web searching for collections in SOLR i found only information about distributed search and so on but when I understand the concept of correclty collections are running on the same server instance using the same schema but are logically completely separated. Is this correct? So I can have 3 collections and searching on one collection won´t output results of another right? Would it be possible to search on more than one collection at once?

But my main priority: How do I create a second collection? Even a link to a good doc would be appreciated. In my solr.xml i have

  <cores adminPath="/admin/cores" defaultCoreName="web-collection" host="${host:}" hostPort="${jetty.port:}">
    <core name="web-collection" instanceDir="." />
  </cores>

Would it be sufficient to create a second core-entry and set different paths? like...

  <cores adminPath="/admin/cores" defaultCoreName="web-collection" host="${host:}" hostPort="${jetty.port:}">
    <core name="web-collection" instanceDir="web" />
    <core name="test-collection" instanceDir="test" />
  </cores>

What is the instanceDir about? Is it the index-directory relative to SOLR-Home?

like image 340
cljk Avatar asked Dec 20 '22 14:12

cljk


2 Answers

You can use multiple cores. Each core is a separate lucene index.
instanceDir is the location of the configuration files for that specific core, the folder that contains the conf directory, which contains schema.xml and solrconfig.xml among others. You usually have a subfolder per core where the solr.xml is (SOLR_HOME) and use relative paths to refer to them within the solr.xml itself.

like image 114
javanna Avatar answered Jan 29 '23 23:01

javanna


For more information on setting up cores and how they work, please see the Solr Wiki - CoreAdmin for more details and some examples.

Your example for adding the second core-entry is sufficient.

The instance directory is the index-directory relative to your SOLR home value.

like image 31
Paige Cook Avatar answered Jan 30 '23 01:01

Paige Cook