Skip to content

Installing ApacheSolr 4.x

Amir Arbel edited this page Sep 30, 2015 · 16 revisions

Needed components:

Download the latest version of apache solr from http://lucene.apache.org/solr/

Download a 4.x version of apache solr from http://archive.apache.org/dist/lucene/solr/4.9.1/

Download the contrib module of apache solr from https://drupal.org/project/apachesolr
Extract the apache solr to an easy to remember location(The home folder can be a good idea).
We called that APACHE_SOLR_FOLDER


Installation process:
In the contrib module you downloaded there is a folder named solr-conf. In this folder there is a folder for each version of apache solr, in our case we will use solr-4.x.
Copy all files from APACHESOLR_MODULE/solr-conf/solr-4.x to YOUR_APACHE_SOLR_FOLDER/example/solr/collection1/conf.


Running:
Go to APACHE_SOLR_FOLDER/example and run the next command (this will run the server):

java -jar start.jar

In order to access the server you should visit the following address:

If you run in to an error then look at the bottom of the document at the Fix - apache solr error

http://localhost:8983/solr/admin/

Indexing:
Using the drush command:

drush solr-index

Using the ui of apachesolr contrib module:

go to admin/config/search/apachesolr/settings/solr/index
  1. Click on Delete the Search & Solr index for delete all the content.
  2. Click on Index all queued content.

Fix - apache solr error:
If you are trying to run apachesolr using the config files from apachesolr module and you're getting the error:

solr could not load config for solrconfig.xml

And the error appears even though the file exists in the directory and it looks good and the right permissions are set...

The solution is:

  • Edit the file solrconfig.xml.
  • Search for the string indexConfig.
  • You should see that three params are duplicated in the indexConfig section.
  • Remove the duplicate lines so they will only appear once in the file, these are the lines that should be removed from the file:
<useCompoundFile>false</useCompoundFile>
<ramBufferSizeMB>32</ramBufferSizeMB>
<mergeFactor>10</mergeFactor>

After doing that, make sure you restart apachesolr and clearcache in drupal. Now it works!