Tuesday, 8 February 2011

Upgrading to Solr 1.4

The version of Solr I have inhertied is now looking a bit stale. Solr 1.4 provides a number of improvements.

Namely performance enhancements in indexing, searching, and faceting.
Improved Java index replication
Easier Configuration
Additional Document types can be indexed

Plus a bunch of other stuff .

Read the release notes for further information.

Anyway down to the nitty gritty.

There are a few things I am going to do before beginning this process.
Namely, Im going to need a database ready and waiting for Solr to index.

Like many of us I use a mysql database. Our dataset it quite large so thats
going to need to be downloaded and set-up before we start. If you need to do this I suggest you kick off a dump and copy your live database to a development sandbox and get it up and running.

I dont have the luxury of being able to run an index on a live , active database.

Also something else you should note is that the solr index files are not interechangeable very easily between different versions of Solr or if you make significant schema changes in Solr's configuration. So you cant really skip this step - make provisions for the time its going to take to setup all your database and indexes.

So ... assuming your database is ready to roll lets begin by downloading one of the apache Solr nightlies.

I choose these as they contain everything you need to run Solr including Jetty , the http servlet container which runs the framework.

I will be going for the following file ...
apache-solr-1.4.1.tgz

which you can grab here.

( you can download directly using the following command )
 wget http://www.mirrorservice.org/sites/ftp.apache.org//lucene/solr/1.4.1/apache-solr-1.4.1.tgz 


once you have downloaded the package you will need to decompress it

tar -xvf apache-solr-1.4.1.tgz


That is basically it. You should be able to start Solr to check its working using the example application.

go into the example folder and start Solr ...

%> cd apache-solr-1.4.1/example
%> java -Xms1024M -Xmx2512M -server -jar start.jar


Solr should spit out a bunch of Information culminating in

INFO: [] Registered new searcher Searcher


Good stuff
We now have a working instance of Solr 1.4.1

See my next post for turning this stock install into something meaningful.

Inheriting a bag of solr worms


Solr
 Installation & Configuration Guide



Having inherited a badly set-up and configured Solr set-up , and tried to tame it - its painfully obvious that what is needed is to bin it and start again.

Before I go any further - If you are new to this area , and looking for a search engine to use for your site do not choose Solr without taking a really good look at Sphinx (http://sphinxsearch.com/) ; In my experience its much more lightweight and easier to get to grips and doesnt have the high overheads of Java. Its a neat, fast 'C' based application with great interfaces for PHP, Ruby and friends. If i had a choice i probably wouldnt have chosen Solr for the project which I have inherited - it adds too many layers of complexity to an already complex web application running on a completely different set of technologies. Sphinx does most of what can be done with Solr so make sure know what features you will actually need and which wont be needed.

If you are experiencing performance issues and Solr is running like a dog maybe this will
be a useful point of reference for you.

Having read the "7 deadly sins of Solr"

Im going to start off by upgrading our aging Solr Search server to a newer version, then take a real, hard look at all those configuration options and see whats going wrong.

Follow these posts they might be of assistance to you.