Archive for the ‘lucene’ Category

Obscene Lucene

Tuesday, February 13th, 2007

Today I tried Apache Lucene and when I got it running it was very fast and rather nice. What is obscene is my title for the entry as there isn’t anything obscene about Lucene but there was a annoyance in trying to get it running. I don’t think I should have had to go through this. Maybe I need more patience.

I downloaded version 2.0.0 and followed the instructions and ran the web app only to get a result like this:

org.apache.jasper.JasperException: Unable to compile class for JSP …
An error occurred at line: 60 in the jsp file: /results.jsp
Note: /home/jamesl/applications/jakarta-tomcat-5.0.28/work/
Catalina/localhost/luceneweb/org/apache/jsp/results_jsp.java uses or
overrides a deprecated API.

So I look for posts about the problem and I find I have to edit the results.jsp and change the following lines from:

try {
query = QueryParser.parse(queryString, "contents", analyzer); //parse the
} catch (ParseException e) {

To:

try {
QueryParser qp = new QueryParser("contents", analyzer);
query = qp.parse(queryString);
} catch (ParseException e) {

Then I restart Tomcat and I try again, but this time Lucene can’t find my index files. So off I go and read the instructions again but no matter how many times I read I can’t seem to overcome the ambiguity. I’m willing to concede that I’m probably just not getting these instructions. I tried removing the leading “/” and it all made sense to me when I got the next error. So I put the index files into the Tomcat “/work” folder and changed the path in the configuration.jsp to be “{path-to-tomcat}/work/index” and all was well and I was able to run the web example. Boy were they fast.

Maybe I’m too impatient or maybe I am spoilt coming from an Agile XP environment where the code works out of the box. Do you think it should work right out of the box? Would you give a toy that required batteries and not give batteries as well?