Creating collections in SOLR

cljk picture cljk · Oct 25, 2012 · Viewed 21k times · Source

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?

Answer

javanna picture javanna · Oct 25, 2012

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.