Apache Solr Search Integration

robertDouglass - December 27, 2007 - 20:41

Solr + PHP: The best solution = Drupal.

This module integrates Drupal with the Apache Solr search platform. Solr search can be used as a replacement for core content search and boasts both extra features and better performance. Among the extra features is the ability to have faceted search on facets ranging from content author to taxonomy to arbitrary CCK fields.

The module comes with a schema.xml file which should be used in your Solr installation.

This module depends on the search framework in core. However, you may not want the core searches and only want Solr search. If that is the case, you want to use the Core Searches module in tandem with this module.

Roadmap

We're marching towards a 1.0 release of this module. There will be one or more alpha releases beyond alpha 3 as we finish implementing features and dealing with known bugs. Once we are feature complete beta releases will begin, followed by a release candidate, and a 1.0 final. Drupal 5 and Drupal 6 branches will move in tandem during that time (where possible; the views integration in Drupal 6 is based on Views 2 and won't be backported).

You can follow the march to 1.0 by tracking critical issues in the queue. "Critical" in this case means "tagged for 1.0".

On September 15, 2008, the Apache project released Solr 1.3. The ApacheSolr module is compatible with 1.2 and 1.3 and will remain compatible with both, even as we try to take advantage of some of the features unique to 1.3.

Patch spotlight

Want to help us make this software better? The #1 priority patch to be looked at right now is: Add "your current search" block

Installation

Install and enable the ApacheSolr Drupal module as you would any Drupal module.

Prerequisite: Java 5 or higher.

Download Solr 1.2 or 1.3 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.2.x/example.

Move apache-solr-1.2.x/example/solr/conf/schema.xml and rename it something like schema.bak. Then move the schema.xml that comes with the ApacheSolr Drupal module to take its place.

Now start the solr application by opening a shell, changing directory to apache-solr-1.2.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/

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

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

Installing on Tomcat

Mike J. O'Connor has written excellent instructions for installing Solr + ApacheSolr on Tomcat using JNDI: http://mikejoconnor.net/content/solr-ubercartorg

Troubleshooting

Your Solr instance is running and you can test it in the Solr admin interface (comes with the Java application). Yet your Drupal ApacheSolr module cannot connect to it to do a search.
To be able to use file_get_contents() in PHP, the "allow_url_fopen" directive must be enabled. In php.ini set the following value:
allow_url_fopen = On

Sites using ApacheSolr

Send me links to your ApacheSolr pages for inclusion in the showcase

Related Projects

Releases

Official releasesDateSizeLinksStatus
6.x-1.0-alpha32008-Jul-1957.09 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-1.0-alpha32008-Jul-1954.29 KBRecommended for 5.xThis is currently the recommended release for 5.x.
Development snapshotsDateSizeLinksStatus
6.x-1.x-dev2008-Oct-0562.94 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
5.x-1.x-dev2008-Oct-0561.37 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
 
 

Drupal is a registered trademark of Dries Buytaert.