Apache Solr Multi-core Setup on Tomcat

Setting up one Solr server with two or more Drupal sites takes some additional configuration. If this is not done, all of the data for each site goes into the same index and when searching on one site, results are returned from both sites. If that's not the desired result (faceting won't currently work correctly), then it is necessary to set up a separate Solr core for each site. Each core is a totally independent search index.

These instructions are the step that I took to set up a Solr Multi-site on Tomcat in a Suse linux environment.  The folder structure and some commands may be different in other environments.  Some of the version

  1. install tomcat6 - should get installed to /usr/share/tomcat6
    zypper install tomcat6
  2. download solr package and unzip to temp folder
    wget http://mirror.metrocast.net/apache/lucene/solr/3.5.0/apache-solr-3.5.0.tgz tar -zxvf apache-solr-3.5.0.tgz
  3. copy example/solr folder to tomcat location
    rsync -rvt example/solr/ /usr/share/tomcat6/solr/
  4. copy war file to tomcat location
    cp dist/apache-solr-3.5.0.war /usr/share/tomcat6/solr/solr.war
  5. copy schema and solr config xml files from apachesolr drupal module
    cp schema-solr3x.xml solrconfig-solr3x.xml /usr/share/tomcat6/solr/conf/
  6. Rename original files in the tomcat solr conf folder then rename files from the apache module
    mv schema.xml schema.org
    mv solrconfig.xml solrconfig.org
    mv solrconfig-solr3x.xml solrconfig.xml
    mv schema-solr3x.xml schema.xml
  7. Make folders for each site you want to use Solr with
    mkdir -p site_one/data site_two/data
  8. Edit solr.xml in /usr/share/tomcat6/solr and making the "cores" section look like the following:
    <cores adminpath="/admin/cores" defaultcorename="site_one">    
      <core name="bluecoat_www" instancedir="site_one"></core>    
      <core name="bluecoat_partners" instancedir="site_two"></core>