On this page
Installing Solr 4.x
This page details how to set up Apache Solr version 4.x for use with the Search API Solr Search module.
Basic setup
As a pre-requisite for running your own Solr server, you'll need Java Runtime version 6 or higher. (For Solr version 4.8 or higher, at least Java 7 is required.)
Download the latest version of Solr 4.x (or the version you want to use) and unpack the archive somewhere outside of your web server's document tree.
For small websites, using the example application, located in $SOLR/example/, usually suffices. In any case, you can use it for developing and testing. The following instructions will assume you are using the example application, otherwise you should be able to substitute the corresponding paths.
Caution! For production sites, it is vital that you somehow prevent outside access to the Solr server. Otherwise, attackers could read, corrupt or delete all your indexed data. Using the example server WON'T prevent this by default. If it is available, the probably easiest way of preventing this is to disable outside access to the ports used by Solr through your server's network configuration or through the use of a firewall.
Other options include adding basic HTTP authentication or renaming the solr/ directory to a random string of characters and using that as the path.
Config files
Before starting the Solr server you will have to make sure it uses the proper configuration files. These are located in the solr-conf/ directory in this module, in a sub-directory according to the Solr version you are using. Copy all the files from that directory into Solr's configuration directory ($SOLR/example/solr/collection1/conf/ in case of the 4.x example application), after backing up all files that would be overwritten.
However, the mapping-ISOLatin1Accent.txt file included in Solr's example application is usually even better suited than the one provided with this module, as it contains a lot of useful character mappings (if you want such conversions to be performed). Therefore, it is recommended that you use the file from Solr's example application in this one case.
For licensing reasons, it is not possible for us to just include that file in our module.
Running Solr
After making sure all necessary config files are in place, you can then start Solr. For the example application, go to $SOLR/example/ and issue the following command (assuming Java is correctly installed):
java -jar start.jar &
Afterwards, go to the Solr admin screen in your web browser to ensure Solr is running correctly.
You can then enable this module and create a new server, using the "Solr search" service class. Enter the hostname, port and path corresponding to your Solr server in the appropriate fields. The default values already correspond to the example application, so you won't have to change the values if you use that. If you are using HTTP Authentication to protect your Solr server you also have to provide the appropriate user and password here.
Note: You will have to execute the above command each time after you restart your machine for Solr to be available. You can find instructions on how to avoid this by making Solr (or any other program) run automatically after a reboot on the internet – they will vary according to your operating system (and, in the case of Linux, distribution), so including them here is not practicable. For Linux, you often can just include the command in /etc/rc.local, though (if that file is present), or add an @reboot line to your crontab.
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