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/drupal

Save 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 errors

This 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 solr

Answer 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.)

Comments

coozila’s picture

What's the point to give an external link to a blog in which the information is inaccurate, we tested the installation but does not work, generates various errors.
You have written this page just to bring traffic to this blog?
Why have not you written here complete details?

splitsplitsplit’s picture

Why have I not stolen someone's hard work and posted it as my own? What a great question.

Someone at Lullabot spent a good amount of their time writing a blog post about how to set up Solr. It's the only reason I managed to get Solr set up. I still ran into problems, I worked them out myself and then wrote this to try and clarify the points I'd struggled with.

You clearly don't want help or contribute because you've not posted any details about any of your problems, just complained. I've found Solr to be notoriously version dependent. Are you using all the same versions as the guide? What are the errors you've run into? Has anyone else had similar errors?

Stop seeing everything as promotion. If someone's wrote great content, promote them, help them. They've taken their time and experience to help people like us who don't understand. If you run into problems, contribute. Help make it a better resource for everyone.

earlyburg’s picture

To note:

Tomcat6 runs on port tcp 8080 in Ubuntu 12.04.
My experience with this was after struggling with Solr 4.x several months ago to no avail when I installed Solr 3.x things worked a lot better with engram searches and content indexing in Drupal.

pinkonomy’s picture

One question:Where is the "start.jar" file in Solr 4 so as to start the server?
thanks

splitsplitsplit’s picture

Hmm not sure. I used the init script in the article I linked to (It's under wrapping up) which restarted the solr server every time I reboot my server, so I've not had to boot it server manually. (I'm also not experienced enough to be able to help further, sorry :( )