- Make yourself a nice cup of tea
- Make sure you have the Windows Java environment installed. It's up to version 6 at the moment.
- I assume you use XAMPP to run Apache and MySQL and latest version of PHP5 and are running a site off Drupal 6.
- If you installed XAMPP with Tomcat, go to your Service Tray, stop XAMPP services and remove the Tomcal directory from within your XAMPP installation. Then restart your XAMPP again. The reason is that you want to be able to configure Tomcat easily from Services Tray in Windows. If Tomcat runs under XAMPP, it does not show up in the Services Tray.
- Before you install Tomcat, copy the file c:\windows\microsoft.net\framework\v1.1.4322\msvcr71.dll to c:\windows\system32\msvcr71.dll If you don't do this, Tomcat won't start up.
- Now install Tomcat 6.x. Start it running. You should get a page showing at http://localhost:8080 if Tomcat is working.
- Have a peek at the file structure of Tomcat. It is very straightforward. Note the directory called webapps.
- Now have a nice cup of tea.
Install Apache SOLR
You now need to download Apache Solr.
- DO NOT DOWNLOAD the 1.3.0 version that you see in the SOLR download page. It will cause you hours of deep, deep pain because it does not work.
- Download the latest nightly file available at http://people.apache.org/builds/lucene/solr/nightly. Unzip it into somewhere like C:\temp\solr
- When you unpack solr you get a shedload of files, and you need to know where to put them to make solr work.
- Look into the directory called C:\temp\solr\dist. You will see a file called apache-solr-nightly-war.
- Copy this file into wherever your Tomcat webapps directory is.
- You will see as if by magic that a directory called 'solr' is created in the webapps directory. This is where the admin pages reside. Don't move this directory or play around with it.
- You now need to create a home directory to run solr. SO this is the bit where the Java files reside and you need to tell Tomcat where to find them.
- Create a new directory - say C:\solr-home
- Go back to the solr files that you downloaded. Have a peek inside the Examples folder. Copy all those files into the C:\solr-home folder.
The directory structure will look like this
- Note there is not conf directory or bin directory.
- So your solr-home ain't going to work!
- Look into the C:\solr-home\solr directory and you will see the conf and bin directories are incredibly inconveniently in there.
- Just move them up one level so they are in C:\solr-home directory.
So now your directory structure will look like
- Now we need to tell Tomcat about the directory.
- If Tomcat is running, go to the Services Tray, double-click the Tomcat icon and stop the service.
- Click on the JAVA tab.
- In the Java Options pane type -Dsolr.solrhome=C:\solr-home or whatever directory you made your solr home directory.
- Restart Tomcat.
- Now go to http://localhost:8080/solr/admin and you should get a page. If you haven't god help you.
- Now have another cup of tea.
Install Drupal Apache SOLR module
- Now download the latest release version of the Drupal Apache Solr INtegration module at http://drupal.org/project/apachesolr
- Install in the normal way. You can try it out but you will get a lot of errors.
- You need to install the SOLR PHP client files.
- DONT GO HERE http://code.google.com/p/solr-php-client/downloads/list. These are wrong files and you will immediately go to hell.
- Getting the correct files is a pain in the ass as you need to send a fancy Unix command to get them. Run this .. svn checkout -r6 http://solr-php-client.googlecode.com/svn/trunk/ SolrPhpClient
- Alternatively, just download the attached version at your own risk http://fabriko.co.uk/files/www.synergynewmedia.co.uk/SolrPhpClient.zip
- Once you have this file, unzip it. It should be a directory called SolrPhpClient. Put this into your apachesoir drupal module.
Configuring Solr and the Apachesolr module
Now we need to tell solr about the Drupal apachesolr module.
- Look into the Drupal apachesolr module.
- Copy the file schema.xml and the file solrconfig and put them into C:/solr-home/conf. In other words you overwrite the ones already there. SO you are now connecting your solr installation to the Drupal apachesolr module.
Or so you thought.
- Now check that solr is still running. Go to http://localhost:80880/solr/admin
- If it works, slap yourself on the back.
- If you get lots or errors then there is a bug that has not been fixed the latest Drupal apachesolr version.
- DEBUG Go to the file C:\solr-home\conf\schema.xml
Replace each instance of
Also replace each instance of
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
See http://drupal.org/node/529606 for discussion of this.
Now try again. GO to http://localhost:8080/solr/admin
It should work. If it isnt pray very hard and go back over your work.
Go to your Drupal apachesolr module and edit the file /SolrPhpClient/Apache/Solr/Service.php
There are 2 lines - the first 2 lines of PHP
require_once(dirname(__FILE__) . '/Document.php');
require_once(dirname(__FILE__) . '/Response.php');
These are the absolute filepaths for the document.php and response.php files that are in the Drupal module apachesolr/SolrPhpClient/Apache/Solr directory
Substitute in the paths to both these files
Save the service.php file.