Search API Solr Search provides a Solr backend for the Search API module, which enables it to use an Apache Solr server for indexing and searching content. Apache Solr is the popular, fast and open source enterprise search platform from the Apache Lucene project suitable for small and large websites alike. Its major features includes powerful full-text search, faceted search and filtering, geospatial search, rich document parsing and indexing and multiple search indices. It also supports spelling suggestions and autocomplete functionality for user queries.
Let's start out by installing and enabling the Search API Solr search module
- Go to "Modules" (admin/modules) and enable:
- Solr search
- (Save Configuration)
The next thing we need to do is install and run Apache Solr on our server. Like I said in the intro, this process varies based on your server configuration, and you'll be able to find a tutorial for your environment by just doing a quick Google search. So for now, I'm just going to show you how to install Solr on a Mac, because that's the local environment I'm using, and then we'll configure Drupal to use the Solr server.
Since Solr is written in Java, we will need the Java Runtime Environment (JRE) version 1.6 or higher to install and run Solr. Running
java -version at the command line should indicate a version number of java installed on your computer.
Next, go to Apache Solr web page and download the most recent release of Solr. For Linux/Unix/OSX systems, download the .gzip file and for Microsoft Windows systems, download the .zip file.
Unzip the file to your server outside your Drupal site or web directory. I'm going to put it on a partition I've created just for this purpose.
Next, we need to overwrite some files that came with Solr with some that come with the Search API Solr module in order for it to work with our Drupal Site
So, we'll go our Drupal directory and copy all of the files from "sites/all/modules/search_api_solr/solr-conf/4.x" (except for the "mapping-ISOLatin1Accent.txt" because the same file that is included in Solr's example application is actually better than the one provided with this module) and then overwrite the same files in the Solr directory inside the "example/solr/collection1/conf" folder.
If you skip this step, you will get an error that says "You are using an incompatible schemaxml configuration file."
Now, let's start the Solr server.
At the command prompt:
Go to the Solr "example" directory and start Solr using the following command:
java -jar start.jar
This will start up the server on port 8983 and use your terminal to display the logging information from Solr. You can see that Solr is running by loading http://localhost:8983/solr/ in your web browser. Now that Solr is installed and running, in the next video, I will show you how to create a Search API Solr Server in Drupal.