Integrate Drupal with Solr
NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:
$ test ! -f "installdir/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."
The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.
NOTE: This guide is only valid for Drupal 7.x
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 schema.xml and solrconfig.xml files to the Solr instance and place them in the installdir/solr/solr/conf directory.
NOTE: Depending on your installation type, the schema.xml and solrconfig.xml files can be found in the following location:
Approach A (Bitnami installations using system packages): installdir/drupal/modules/contrib/apachesolr/solr-conf
Approach B (Self-contained Bitnami installations): installdir/apps/drupal/htdocs/modules/contrib/apachesolr/solr-conf
Restart the Solr server:
$ sudo installdir/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://localhost: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.
For more information, refer to the documentation for Drupal configuration with Solr.