Solr search, Drupal and CentOS
I keep meaning to write shorter blog posts. For once this one is easy to write as a short piece. Solr is a powerful search server, and there has been some great work making a solr module that integrates really cleanly with Drupal. I've kept putting off trying it out because of the expected pain of having to get the correct java version, and then fight with tomcat to get it to work properly etc. etc. But and it short...
It works!
It works out of the box with the openjdk-1.6.0 rpms, with the packaged jetty container. Follow the README to get the phplibrary and swap over the configs in the example as described. Run java -jar start.jar
and your in business! The docs explain the packaged jetty is good for a single instance (smaller) production site even.
But it works with Tomcat too! Not quite out the box for me, but using the tomcat5 rpm and following the SolrTomcat "Configuring Solr Home with JNDI" section, just:
- copying the apache-solr-nightly/example/solr/ as the /my/solr/home and
- copying the apache-sorl-nightly/dist/apache-solr-nightly.war as /some/path/solr.war
- both to somewhere tomcat could get to it (it's running as user tomcat)
- swapping over the configs just as before with the jetty README version
Plus the not quite out the box bit. It was giving me the error SEVERE: Exception starting filter SolrRequestFilter
Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: <a href="http://java.sun.com/jaxp/xpath/dom" title="http://java.sun.com/jaxp/xpath/dom">http://java.sun.com/jaxp/xpath/dom</a> with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom
. The libraries for this xml are installed in the dependencies (xalan-j2 and xerces-j2) but clearly not in a path expected somewhere. So for now I just symlinked them from location (/usr/share/java/.) into the (/usr/share/tomcat5/webapps/solr/WEB-INF/lib) directory. But even with tomcat with the rpms that was it!
Brilliant!