Skip to content

Installing ApacheSolr 4.x

David edited this page Feb 18, 2014 · 16 revisions

Needed components:
Download the latest version of apache solr from http://lucene.apache.org/solr/
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 cotribe module you downloaded there is a folder called solr-conf.
In the folder there is a folder for the version of apache solr:
We need the files from solr-4.x.
Please copy all files

Copy those files to 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:

false 32 10


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