On this page
Example installation: Ubuntu 12.04 LTS
For people who are brand new to Solr and Search API, here is an example installation.
It uses and has been tested to work with:
- Ubuntu 12.04 LTS
- Solr 4.5.1
- Tomcat 7
If you don't want to do the installing manually you can try an Ansible script, maintained by jiv_e, which automates the process. See https://github.com/jiv-e/ansible-multicore-solr. Versions may differ from above. Tested on Ubuntu 12.04.
Getting started
Solr is a standalone search platform, it runs off Java and it's best run in a specific Java Server Environment.
Typically we install Tomcat or Jetty as that server and for this example we'll be using Tomcat.
Now there's already an excellent guide that exists for this first part so head to Installing Solr for use with Drupal and follow all the instructions up to Solr Indexes. You'll need to replace the all the references to Solr 4.3.0 with Solr 4.5.1.
Excellent all done?
Now we need to configure Solr to work with Search API.
As pointed out on the first page of documentation the file structure for solr 4.3 and above needs to be changed to work with Search API so we move the contrib directory:
mv /usr/local/src/solr-4.5.1/contrib /usr/local/src/solr-4.5.1/example/
Then we download the Search API Solr Module, and copy the conf files into the solr installation.
rsync -av /path/search_api_solr/solr-conf/4.x/ /usr/local/src/solr-4.5.1/example/solr/collection1/conf/
Now we copy those newly changed configuration files into our Solr folder in Tomcat.
mkdir -p /usr/local/tomcat/solr
cp -r solr-4.5.1/example/solr/collection1/conf /usr/local/tomcat/solr/
Now we can jump back to:
Installing Solr for use with Drupal
And continue with the instructions, starting from Solr Indexes, Step 4 and finish off the rest of the tutorial.
Important Points
1. You don't need the Apache Solr Module. Having it enabled can actually cause some problems.
2. The configuration files from the search api module should be in three places. The config in your actual solr install. The conf in the solr folder and the conf in the drupal folder.
Drupal Set-up
Now we should have a server. Time for the Drupal side of things.
Head to /admin/config/search/search_api and add a Server.
You then put the following values into the Service area:
Protocol: HTTP
Solr Host: localhost
Solr Port: 8983
Solr Path: /solr/drupalSave settings and you should be greeted with a message that the Solr Server can reached. Congratulations.
Possible Problems
If you get a no core exists message:
It's probably caused by the duplicate line problem shown here.
Bad Request 400. No items are indexed.
I had this problem and I think it was related to changing my server from Database Search to Solr. Removing the Server and recreating it seemed to fix this.
Error Filter Start
You'll find this error in the tomcat logs, which will be (If you've followed the instructions above) at the following path:
/usr/local/tomcat/logs/catalina-*date*.log
Apr 11, 2015 4:54:11 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
Apr 11, 2015 4:54:11 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/solr] startup failed due to previous errorsThis error can fixed by running the following commands
cp /path/to/solr/example/lib/ext/* /path/to/tomcat/lib
cp /path/to/solr/example/resources/* /path/to/tomcat/lib // or inside extracted solrAnswer taken from the following stack exchange question.
Restarting the solr service
When you're trying to set-up solr, the tomcat dashboard can be useful for debugging and restarting the server.
Go to the tomcat server base URL (if you've followed the example above it will be *serverurl:8983", then select server status.
You'll need to set-up a user in tomcat to get past basic authentication and load this screen, (by default tomcat provides no user and so the basic authentication blocks everyone).
You can add a user at the following path (if you've followed the instructions above):
/usr/local/tomcat/conf/tomcat-users.xml
(Information on what user to add is in the file.)
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion