Solr and Coldfusion -- Setting Up

To get up and running with Solr, you'll need some type of Servlet container. Typically when folks start talking about servlet containers, they're talking about Tomcat or Jetty. In fact, Solr comes with Jetty 6.1.3 (they haven't upgraded to 6.1.5 yet in the distribution). You may also hear about Resin, but in my experience, it runs a bit slower than Jetty and Tomcat. As a small note, servlet containers are different than J2EE application servers like JRun, Geronimo, GlassFish, and JBoss (which use servlet containers like Tomcat and Jetty, but also have EJB containers and can handle other types of logic). If you have a J2EE application server running, you can easily use Solr, and if not, consider using Jetty or Tomcat as your container server.

Since your environment can be as varied as there are IT departments, I won't try to cover everything. Essentially you need to have at least the Java 1.5 JRE. However, I would strongly suggest the most current Java JDK (and not the JRE) as it has performance enhancements to run in server mode (with -server). If you don't already have this Java version installed on your server (assuming this is the same server running CF), don't worry, ColdFusion will still work if you install the required Java runtime.

Essentially the process for deploying Solr, once you have a servlet container up-and-running is to drop the solr.war file into the webapps directory on the server. It won't do anything at this point as you need to set the configuration files for Solr. The easiest way to do this is copy the files from example/solr into a new directory (which I will refer to now as solr_home).

You can tell Java about the home directory by setting the solr.solr.home (-Dsolr.sol.home), set the JNDI lookup ("java:comp/env/solr/home"), or just throw it into the JVM's working directory (the default path is ./solr). Now you just need to make sure everything is running. Just point your browser to http://<server>:<port>/solr/admin. You should then see the administration interface (you may need to restart your servlet container to get everything working properly), but it's not an administrative interface like you get in CFAdmin. This is more of an informational administration panel. You can make sure everything is running, that there are documents in your index is set up properly, check out the schema and configuration files, and thread information. Really the only thing you can administer here is the log level.

For some more specific notes on intalling Solr in Tomcat and Jetty, check out Solr's wiki. In particular, if you're going to need multiple instances of Solr to run, pay attention to the sections on Multipe Solr apps on those wiki pages.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Matthew Lesko's Gravatar Have you tried, or is there a reason not to, run Solr inside of a JRun instance? And/or is it possible to run it in the same instance as Coldfusion?
# Posted By Matthew Lesko | 10/5/07 1:52 PM
Wayne Graham's Gravatar You know, after I wrote JRun, I began to think better of it. It's been a while since I've looked at the software and I had assumed they would keep up with the servlet standards. However, after you asked and I did a little looking, it looks like JRun supports the 2.3 servlet standard, and Solr requires the 2.4 servlet standard.

So, unless I'm looking at an old page, Solr won't run under JRun. However, Jetty and Tomcat are pretty light (Jetty more so than Tomcat). Jetty also performs pretty decently in my tests (you can check them out at <a href="http://techview.wordpress.com/2007/08/16/benchmark...">my other blog</a> . There's also another option that I've not mentioned yet with Embedded Solr. This acts more like Verity does, but still uses the core files. I haven't looked at this for use with ColdFusion, but it would most likely require writing some convenience classes in Java and a wrapper in CF.
# Posted By Wayne Graham | 10/5/07 2:08 PM
Matthew Lesko's Gravatar Did a little investigation on embedding. The class org.apache.solr.servlet.DirectSolrConnection appears to be the solution for that approach.

JavaDoc: http://lucene.apache.org/solr/api/org/apache/solr/...
# Posted By Matthew Lesko | 10/5/07 4:21 PM
Wayne Graham's Gravatar DirectSolrConnection is a method for doing this, but in working on the Vufind indexer for bibliographic records (I've got about 1.8 million to do), it was unnecessarily slow for inserts so I used the embedded solr which, for the purposes of fast indexing, fit the bill a bit better. Granted this was for straight-up indexing and not for searching, but take a look at the examples at

http://wiki.apache.org/solr/EmbeddedSolr

for more info on using both of these methods.
# Posted By Wayne Graham | 10/5/07 4:34 PM
Wayne Graham's Gravatar One other thing with the DirectUpdateHandler...

You need to add a new requestHandler to your solrconfig.xml file to use it...

&lt;requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />

It took a while to actually find the correct class to use with this.
# Posted By Wayne Graham | 10/5/07 4:37 PM