Want to learn more about search in Drupal 7? Then check out our online video course called “Build Powerful Search Pages with Views and Search API in Drupal 7“.
Running Search API and Apache Solr just got easier thanks to the latest release of the Search API Solr search module. This module allows you to use Solr as a server backend for Search API indexes. In the latest release (7.x-1.0-rc4) the module no longer has a dependency on the SolrPhpClient library.
In this tutorial I’ll show you how to setup a local development Solr server on Mac OS X 10.8.3.
Please note that this tutorial should only be used to setup a development server where you’re not worried about locking down Solr. If you want to setup Solr for a production site, then make sure you lock down the server so users can not get access to Solr.
Step 1: Check Java
First, check and make sure Java is installed. Open the Terminal app and enter
java -version, if the version is 1.6 you’re good to go.
Step 2: Download Search API Solr Module
If you use Drush, run the following command:
$ drush dl search_api_solr
Step 3: Download Solr
Before we begin, download Solr (3.x) and extract the tar or zip file somewhere on your filesystem. Currently, only Solr 3.x is supported so don’t download the 4.x version.
Step 4: Configure Solr
Go to where you extracted Solr and duplicate the
example folder. Rename the duplicated folder
drupal-search. You can call the folder whatever you want just make it descriptive.
Go to the Search API Solr module and copy the files in the
search_api_solr/solr-conf/3.x folder into
drupal-search/solr/conf within Solr itself.
Step 5: Start Solr
Now we have everything setup it’s time to start Solr. We need to run Solr from the Terminal App, so open Terminal and go to the Solr directory.
Go into the
drupal-search folder and run
java -jar start.jar.
To see if Solr is working, go to http://localhost:8983/solr/admin/ and you should see the Solr administration page.
Step 6: Create Search API Server
The last and final step is to create a Solr Search API server for our index.
1. Go to Configuration -> “Search API” and click on “Add server”.
2. In the text field “Server name” enter “Solr server” and from the “Service class” drop-down list select “Solr service”.
3. Leave all the Solr settings as is and click on “Create server”.
4. When you create an index, make sure you select “Solr server” from the Server drop-down list.
If you want to learn how to use Search API please read “Intro To Search API (Part 1) – How To Create Search Pages” and “Intro To Search API (Part 2) – Faceted Search“.
If you have any questions, please leave a comment.