Apache Solr Search Integration

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

Other documentation and videos

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

Use Solr 1.4.x, 3.5.x or 4.6.x

The configuration files use features from Solr 1.4.x, so Solr 1.3 is not supported. Solr 4.6.0 or 3.5.0 or later is now preferred.

Installation Prerequisites

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 PECL json extension into PHP or (for those who cannot install PHP extensions) if you install the Zend Framework JSON classes as described in the README.txt

For Drupal 6.x-1.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 (required for 6.x-1.x), 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:

svn export -r22 http://solr-php-client.googlecode.com/svn/trunk/ SolrPhpClient

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.

Installing Apache Solr

Instructions for installing apache solr on your environment can be found here

Enabling facets

(7.x or 6.x-3.x)

(in order to do this, you have to install FacetAPI)
1. Go to Administer > Configuration > Apache Solr Search > Settings
2. Click "facets" next to the search environment you're currently using.
3. Check the facets that you want to add an click "Save configuration".
4. Go to Administer > Structure > Blocks. A block for each facet that you enabled will be available. Place the block in the region where you want it to show.
5. Click "Save blocks."

Enabling facets (6.x)

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

Upgrades from 6.x-1.x or 6.x-2.x

IMPORTANT: there is no upgrade path from 6.x-1.x or 6.x-2.x. If you previously
installed those modules you must disable and uninstall them prior to
installing 6.x-3.x or 7.x-1.x.

You will have to install the new schema.xml and solrconfig.xml files, and restart
the Solr server (or core) and delete your index and reindex all content.

A Solr Query's tale

Concepts: use of the Dismax/EDismax query handler

Exposed Solr Hooks (6.x-1.x) for developers

hook_apachesolr_modify_query(&$query, &$params, $caller);

Exposing fields to Solr

If you need to expose custom fields (whether created with Fields or in a module) to Solr, first determine which of the following applies:

Installing Apache Solr Search with free (trial) Opensolr server on Drupal 7

Download and install the Apache Solr Module - https://drupal.org/project/apachesolr

Installing and configuring a Solr server

While Solr is very easy to get running initially, there are quirks to using it in different OSs or with different packages. Child pages

Modifying queries and index data using Apache Solr Search Integration hooks

The Apache Solr Search Integration module has lots of points for modifications via the API. Suggestions for customizing the Drupal module

Sequence diagram / flow diagram

Apache Solr Search Integration Sequence Diagram.

Sites Using ApacheSolr

Troubleshooting Solr

WHAT/WHERE search + Solr 3.6 + location(lat/lng) + radius based search

This doc will help you to

Guide maintainers

aufumy's picture