Community Documentation

Apache Solr Search Integration

Last updated January 9, 2012. Created by aufumy on December 6, 2008.
Edited by Nick_vh, yngens, pfrenssen, technicalknockout. Log in to edit this page.

This documentation is for the Apache Solr Search Integration module that integrates Drupal with a Solr server for searching.

Other documentation and videos

There is another Drupal module for interfacing with Solr but it is currently less developed.

You should also read the README.txt as it may be more up to date than this page.

Use Solr 1.4.x

The configuration files use features from Solr 1.4.x, so Solr 1.3 is not supported..

Installation

Prerequisites: Java 5 or higher. For Drupal 6.x-1.x, PHP 5.2 is recommended, but PHP 5.1.4 will work if you install the into PHP the PECL json extension or (for those who cannot install PHP extensions) if you install the Zend Framework JSON classes as described in the README.txt

Install the the Apache Solr Drupal module files as you would any Drupal module.

For Drupal 6.x-1.x and 6.x-2.x you need the PHP library from the external project. The project is found at: http://code.google.com/p/solr-php-client/.

This library can be installed either in the apachesolr module directory, or in sites/all/libraries/. The latter requires you to have the Libraries module installed, but has the benefit that the library does not need to be reinstalled when performing module upgrades.

To install the library, go to either the apachesolr module directory or sites/all/libraries/, and run this command:


Note that revision 22 is the currently tested and suggested revision. It is generally not needed to install newer versions (like r60). Make sure that the final directory is named SolrPhpClient under the apachesolr module directory.

Those without svn, etc may also choose to try the bundled Acquia Search download, which includes all these items which are not in Drupal.org git repository due to use git policy. See the download link here: http://acquia.com/documentation/acquia-search/activation

You should now be able to enable the Drupal module, but you may wish to wait until Solr is running (see below).

Installing Solr

Download Solr 1.4 from a mirror site: http://www.apache.org/dyn/closer.cgi/lucene/solr/

Unpack the tarball somewhere not visible to the web (not in your apache docroot and not inside of your drupal directory).

The Solr download comes with an example application that you can use for testing, development, and even for smaller production sites. This application is found at apache-solr-1.4.x/example.

Rename apache-solr-1.4.x/example/solr/conf/schema.xml and solrconfig.xml to something like *.bak. Then copy the schema.xml and solrconfig.xml that come with the Apache Solr Drupal module to take their place.

Now start the Solr application by opening a shell, changing directory to apache-solr-1.4.x/example, and executing the command java -jar start.jar

Test that your Solr server is now available by visiting http://localhost:8983/solr/admin/

Ensure that both the main Apache Solr Framework and Apache Solr Search modules are enabled. NOTE: If the Apache Solr Search module is not enabled no indexing will occur.

Now run cron on your Drupal site until your content is indexed.

Return field list when using Jetty http://localhost:8983/solr/admin/luke?numTerms=0&wt=json

Enable blocks for facets at Administer > Site building > Blocks.

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.