Tuesday, May 13, 2014

SOLR: Adding a new core

1. Create the required directories. Let's assume that the data directory is under /solr.
    /solr/new_core1/conf
    /solr/new_core1/data

2. Copy the conf directory from the existing core
    /solr/collection1/conf/* /solr/new_core1/conf

3. Create a solr.xml file in /solr/new_core1/conf directory, write below code in it:

<!--solr persistent="true" sharedLib="lib"-->
  <!--cores adminPath="/admin/cores"-->
    <!--core name="new_core1" instanceDir="/solr/new_core1"-->
      <!--property name="dataDir" value="/solr/new_core1/data" /-->
    <!--/core-->
<!--/solr-->


(remove comment before using the code)

4. Since the dataDir property is already defined in the solr.xml file, we need to comment out the dataDir element in /conf/solrconfig.xml. Search and replace with below line:

${solr.data.dir:./solr/core1/data}

5. Restart SOLR services (solrJetty).
Browse the solr to view the core:
http://localhost/solr/#/~cores/new_core1

No comments:

Post a Comment

web stats