Thursday, June 21, 2007

Hibernate Search: good integration of Lucene and Hibernate

In the last 2 years, when not too busy consulting, I have been working on a knowledge management system KBSportal. While I have prototyped some ideas in Ruby and Common Lisp, my final target implementation language has always been Java (trying to make something that will be very widely used).

In the Java version, I implemented a threaded asynchronous system for maintaining both a relational database and manage Lucene indices and search. Last night I spent some time reading the documentation and playing with the Hibernate Search example programs. Hibernate Search supports both an asynchronous update mode and a simpler synchronous mode where objects are created in a relational database and immediately indexed for search. The search API returns either object IDs and search scores or simply returns Java objects matching a search query. The important thing to me is that by using Hibernate Search I can remove a lot of my own code making my system easier to understand and modify, and take advantage of future improvements made by the Hibernate Search developers. Writing my own version was fun and educational, but I like the Hibernate Search implementation more than my approach that was custom fitted to my application. Great stuff!

For Ruby developers: check out acts_as_ferret that provides the same kind of integration between ferret (Ruby/C port of Lucene) and ActiveRecord: also good stuff!

3 comments:

Anonymous said...

Hello,

And for CommonLisp developers, we have Montezuma .

Mark Watson, author and consultant said...

I have also used John Wiseman's Montezuma - worked well for me, but I use Lucene and ferret more often. Their is also a very fast indexing and search library built on top of Franz Lisp BTrees.

Alka said...

Hi,
Packt Publishing is developing a mini book titled " Hibernate Search " and we are searching an author for it.

During my search I came across your profile and blog on the subject and was impressed by your level of experience and activity within this area and wondered whether you might be interested in this project.

Let me know if this interests you so that I can get back to you with more details. You can contact me at alkan@packtpub.com

Alka Nayak
Author Relationship Executive