-
Notifications
You must be signed in to change notification settings - Fork 8
Installing Solr Search
The search functionality of OSCI requires Apache Solr to be installed on your server. There are several ways to install Solr, depending on your environment. Here, we will assume that you are running an Ubuntu server, and we will install Solr wrapped in Apache Tomcat. Once you are more comfortable with Solr and other services, you can certainly explore other options. Please feel free to edit this wiki page with any additional information.
First, we will follow this tutorial to update our Java Development Kit and install the solr-tomcat
package. Open terminal, SSH to your server, and run the following commands:
sudo apt-get update
sudo apt-get -y install openjdk-7-jdk --fix-missing
java -version
sudo mkdir /usr/java
sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/java/default
sudo apt-get -y install solr-tomcat
For this tutorial, we assume that your OSCI instance is located at example.com
.
Check to make sure that Solr is successfully installed:
http://example\.com:8080/solr
If you installed Solr directly, instead of using solr-tomcat
, your port is likely 8983
, not 8080
.
Find what version of Solr you've installed here:
http://example\.com:8080/solr/admin/registry.jsp
Drupal's Apache Solr Search module is compatible with several versions of Solr. We’ll assume you have 3.x
for the purposes of this tutorial.
Copy all 11 files in /sites/all/modules/apachesolr/solr-conf/solr-3.x
to /etc/solr/conf
.
To be safe, make a backup of any files which would be overridden.
If you've installed a different version of Solr, you will need to copy files from a different solr-conf
subfolder. The total number of files you'll need to copy might change. solr-1.4
for instance, has only three files. In all cases, you will need to copy over all the files in the folder.
Next, you will need to reload the Solr instance. There are several ways to do it, but the easiest route is probably via the Tomcat admin panel. Run this command to install the Tomcat manager:
sudo apt-get -y install tomcat6-admin
You will now need to add a user to /etc/tomcat6/tomcat-users.xml
You might need to sudo chmod
that file first to make it editable.
Example admin user:
<tomcat-users>
<role rolename="manager"/>
<user username="admin" password="admin" roles="manager"/>
</tomcat-users>
After modifying and saving tomcat-users.xml
, you must restart the Tomcat service:
sudo service tomcat6 restart
Access the Tomcat manager panel here:
http://example\.com:8080/manager/html
Login with the user you just created.
Click the Reload
command on the /solr
application.
Give it a minute or so to restart, just in case.
Now, you must verify that the new schema is loaded correctly.
Go to http://example\.com:8080/solr/admin and click Schema
Verify that <schema name="drupal-4.3-solr-x.x" ..>
, where x.x
fits your Solr version.
Getting HTTP 500
errors? You might've copied files from the wrong solr-x.x
to /etc/solr/conf
. Verify which version of Solr you installed, perhaps by checking the version of the tomcat-solr
package you apt-get
-ed earlier and cross-referencing that with its docs.
At this point, you've completed the terminal-heavy part of the tutorial. Congrats! Everything else should be fairly straight-forward config through the Drupal admin panel.
First, you must ensure that the following three modules are enabled in Drupal:
- OSCI Search
- Apache Solr framework
- Apache Solr search
Click Configure
for the Apache Solr framework
module. You'll be taken to this page:
http://example\.com/admin/config/search/apachesolr/settings
If the default localhost server
row is lighting up red, you might need to change its URL as appropriate. For instance, in our case, we might change it to http://example.com:8080/solr
Next, go to the Default Index
menu.
Click Delete the Search & Solr index
(optional)
Click Queue all content for reindexing
Click Index all queued content
. Confirm.
You must now wait at least two minutes. Solr is not real-time.
Meanwhile, visit here while you wait:
http://example\.com:8080/solr/select/?q=*%3A*&qt=standard
This is the absolute smallest wildcard query that will return results.
At first, while Solr is still indexing content, it will return an empty result set.
Refresh that page every minute or so until it is done (2-3 min).
Explore the Solr admin panel for more options:
http://example\.com:8080/solr/admin/
All set! Good luck.
Have questions? Please ask on the mailing list.
Table of Contents
Other Links