lucene search up and running

Inspired by Sam Ruby, I got Lucene to search this site.. My search sample size is pretty small, but 10 milliseconds for a search on any site is pretty fast. How?

First, download the Lucene binaries.

Second, throw lucene-1.2.jar & lucene-demos-1.2.jar into your classpath or into your $siteroot/WEB-INF/lib folder.

Run a quick index of the html files you want indexed:

# java -classpath #InsertPathToAboveMentionedJars org.apache.lucene.demo.IndexHTML -create #InsertPathToFilesYouWantIndexed

And then you can run a query using the sample jsp provided w/ the Lucene download by changing the path to the index you created. Pretty simple!

Maybe someday I’ll polish up the scripts and add it to Moveable Type’s External Resources page.

Leave a Reply

Your email address will not be published. Required fields are marked *