On this page
Apache Solr Multi-core Setup using Jetty
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.
- Download Solr 1.4.1 from a mirror:
http://www.apache.org/dyn/closer.cgi/lucene/solr/ - Download the Apache Solr Drupal module and unzip wherever you put your Drupal modules.
- 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).
- Unpack the tarball OUTSIDE OF THE WEB ROOT. This will create a folder called "apache-solr-1.4.1".
- Make a copy of the "example" directory found in the "apache-solr-1.4.1" directory; call it "drupal".
- 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.
- Go to where you unzipped the Solr Module. Copy "schema.xml" and "solrconfig.xml" to "apache-solr-1.4.1/drupal/solr/conf"
- Delete the following directories. They're just in the way:
- example-DIH
- exampleAnalysis
- exampledocs
- work - Copy "drupal/multicore/solr.xml" to "drupal/solr/solr.xml"
- Delete the "drupal/multicore" directory.
- 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 - 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.
- 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>
- Now fire up the Jetty servlet container from the command line in the "drupal" directory with: "java -jar start.jar"
- 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.
-
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! - 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.
- 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.
- 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.
- 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
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion