Apache Solr Multi-core Setup using Jetty

Last updated on
30 April 2025

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 for Windows XP/Server 2K3 so the paths might look a bit different for folks using Linux or Mac servers, but this should work.

  1. Download Solr 1.4.1 from a mirror:
    http://www.apache.org/dyn/closer.cgi/lucene/solr/
  2. Download the Apache Solr Drupal module and unzip wherever you put your Drupal modules.
  3. For Drupal 6.x-1.x, download the Solr PHP Client library (http://code.google.com/p/solr-php-client/downloads/list) and unpack it so it is under the apachesolr module directory as SolrPhpClient (i.e. sites/all/modules/apachesolr/SolrPhpClient).
  4. Unpack the tarball OUTSIDE OF THE WEB ROOT.  This will create a folder called "apache-solr-1.4.1".
  5. Make a copy of the "example" directory found in the "apache-solr-1.4.1" directory; call it "drupal".
  6. Go to "apache-solr-1.4.1/drupal/solr/conf" and rename schema.xml and solrconfig.xml.  Add a .bak to the end or something.
  7. Go to where you unzipped the Solr Module.  Copy "schema.xml" and "solrconfig.xml" to "apache-solr-1.4.1/drupal/solr/conf"
  8. Delete the following directories.  They're just in the way:
    - example-DIH
    - exampleAnalysis
    - exampledocs
    - work
  9. Copy "drupal/multicore/solr.xml" to "drupal/solr/solr.xml" 
  10. Delete the "drupal/multicore" directory.
  11. Now create directories within the "drupal/solr" directory for each site you want to use Solr with.  For example, if I had two sites "anovasolutions.com" and "myrandomideas.com" and I wanted to use Solr with them both, I might create the following directories:
    drupal/solr/site_anovasolutions
    drupal/solr/site_myrandomideas
  12. Copy the "drupal/solr/conf" directory into each directory you just created. When you're done each site's directory should have a copy of "conf" in them.
  13. Now alter the solr.xml file you copied over to list both sites.  So your solr.xml would look like this:

    <?xml version="1.0" encoding="UTF-8" ?>
    <solr persistent="false">
    <cores adminPath="/admin/cores">
      <core name="anovasolutions" instanceDir="site_anovasolutions" />
      <core name="myrandomideas" instanceDir="site_myrandomideas" />
    </cores>
    </solr>
    
  14. Now fire up the Jetty servlet container from the command line in the "drupal" directory with: "java -jar start.jar"
  15. Enable the "Apache Solr framework" and "Apache Solr search" modules. Also, enable the core Drupal Search module if you haven't already. Do this for both sites.
  16. Navigate to the Solr Settings page for each site (?q=admin/settings/apachesolr/settings).
    - Solr host name: localhost
    - Solr port: 8983
    - Solr path for anovasoutions.com: /solr/anovasolutions
    - Solr path for myrandomideas.com: /solr/myrandomideas
    - Number of items to index per cron run: I always set this to 200.
    - Enable spellchecker and suggestions: Check that...it's sweet!
  17. Click "Save Configuration."  The first time around it'll probably tell you it can't reach the server, but if you refresh the page you'll be good to go.  
  18. Note that you're going to have to start Solr every time you reboot the machine.  Windows users, set up a scheduled task.  *nix/Mac users, follow these instructions.  There's a great walkthrough there as well.
  19. Check out admin/blocks.  You'll see a bunch of new blocks related to Solr.  I'd just activate all of these so you can get an idea of what you're dealing with.
  20. You're going to need to run cron until the entire site is indexed.  If you have a lot of content, this could take a while.

Adapted with permission from: http://www.anovasolutions.com/content/drupal-apache-solr-search-multi-si...

Note

After following these instructions the admin page will use a different path. The core name needs to be inserted in the path. For example the admin path for a core with the name "examplecore" would be
http://localhost:8983/solr/examplecore/admin/

Help improve this page

Page status: Not set

You can: