Drupal Apache Solr Search: Single Site (Instance) Setup
Apache's Solr Search is an amazing faceted search that operates in a manner much like Endeca or Mercado...except that instead of costing over $60,000, Solr is FREE. There's a really good walkthrough here. Maybe better than this one.
- Solr is pretty easy to get going. Download Solr from a mirror: http://people.apache.org/builds/lucene/solr/nightly/ OR http://www.apache.org/dyn/closer.cgi/lucene/solr/
- Download the Apache Solr Drupal module and unzip wherever you put your Drupal modules.
- Download the Solr PHP Client from Google and unzip inside of the apachesolr modules folder (e.g. /sites/all/modules/apachesolr/).
- Unpack the tarball OUTSIDE OF YOUR WEB ROOT. You'll end up with a folder called "apache-solr-nightly".
- Go to "apache-solr-nightly/example/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-nightly/example/solr/conf"
STOP HERE IF YOU'RE DOING A MULTISITE INSTALL - Now navigate via the command line (if you're not already there) to "apache-solr-nightly/example" and execute the following command: java -jar start.jar (I'm assuming you have Java installed).
- Enable the "Apache Solr framework" and "Apache Solr search" modules. Ignore the others. Also, enable the core Drupal Search module if you haven't already.
- Navigate to the Solr Settings page (admin/settings/apachesolr/settings).
- Solr host name: localhost
- Solr port: 8983
- Solr path: /solr
- 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 schedule 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.
Now, if you have your own virtual or dedicated server (a requirement to even do this) you're probably hosting multiple sites on that server. And you're probably going to want to use Solr on more than one.
The bad news is that this isn't really supported. The good news is that I figured out how to do it. Check out "Apache Solr Search: Multi Site (Instance) Setup".
- Log in to post comments