Integrate Drupal with Solr

Introduction

The Bitnami Drupal Stack with Drupal v7 ships a plugin to enable integration between Solr and Drupal. Follow these steps:

Ensure that you have a running Drupal instance and a running Solr instance.

On the Solr instance, open the Solr port (by default, 8983) so that Drupal can communicate with Solr. Refer to the FAQ for more information on how to open a port.

The Bitnami Drupal Stack already has the Apache Solr Search Integration module installed. In case it doesn’t, you can install it from the Drupal administration panel. Then, enable the Solr Search and Access modules.

From the Drupal instance, copy the /opt/bitnami/apps/drupal/htdocs/sites/all/modules/apachesolr/solr-conf/schema.xml and /opt/bitnami/apps/drupal/htdocs/sites/all/modules/apachesolr/solr-conf/solrconfig.xml files to the Solr instance and place them in the /opt/bitnami/apache-solr/solr/conf directory.

Restart the Solr server:

$ sudo /opt/bitnami/ctlscript.sh restart solr

Log in to the Solr administration panel and verify that it now displays drupal-3.0-beta16 or drupal-3.0-0-solr3 or similar in the page heading, as shown below:

On the Drupal instance, log in to the Drupal administration panel, navigate to “Modules -> Search toolkit” and enable both the Apache Solr framework and Apache Solr search. Click the “Save configuration” button to save the changes.

Click the “Modules -> Solr Search Framework” configuration button and add a new connection using the data below:

URL: http://SERVER-IP:8983/solr

Name: Remote Solr

Test the connection. If the Drupal instance is not able to contact the Solr instance, check that the IP address used in the connection setting above is correct and that the 8983 port is open for connections.

Configure the Drupal application to use Solr by default for search, by navigating to the “Configuration -> Search settings” section and enabling Apache Solr search in the default search modules.

If the Drupal instance already holds content, re-index the content.

The Drupal instance should now be configured to execute searches using the Solr search engine. Test it by performing a search using the site search block on the Drupal instance and checking the result.