Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Hibernate Search: Indexed Full Text Search of your Domain Model

Hibernate Search: Indexed Full Text Search of your Domain Model

This item in japanese

The second beta of the new Hibernate Search project was recently released. InfoQ spoke to Emmanuel Bernard, the project lead of Hibernate Search (and also of Hibernate Annotations and Hibernate EntityManager) to find out more. According to Emmanuel, the Hibernate Search project is aimed at users of Hibernate or the Java Persistence API (JPA) that want to make their Hibernate/JPA-managed objects accessible via indexed, full-text search. Some of the features of Hibernate Search include:
  • Lucene integation - Lucene has a proven track record as a powerful and efficient search engine
  • Automatic insertion and updating of data - When an object is added or updated by Hibernate, the search index is also transparently updated
  • Support for many complex kinds of search - You can perform wildcard searches, multi-word text searches, approximation/synonym searches, or ordering of search results by relevance in a very fast manner
  • Search clustering - Hibernate Search has some built-in clustering solutions, including a JMS-based, asynchronous querying/indexing system
  • Direct Lucene API fallback - If you need to do something particularly complicated, you can use the Lucene API directly to form your queries
  • Automatic Lucene management - Hibernate Search takes care of managing and optimizing Lucene's index, and using the Lucene API in an efficient manner

The major goals for the project include:

  • Ease of use - Like Hibernate's ORM, Hibernate Search does the job for 90% of your cases and lets you focus on the the remaining, more difficult portions
  • Consistency with the existing Hibernate/JPA programming model - A natural integration with this programming model "has been a goal from day one"

Emmanuel gave us a few concrete examples of these goals in practice, including:

  • An HQL query can be turned into a search query by changing the way an object is built, "a few lines of code usually" - everything else (query execution, result format) is the same
  • There is no bootstrapping process, because Hibernate Search transparently leverages the existing Hibernate/JPA infrastructure
  • The minimal configuration requires that two properties be set in either persistence.xml or in hibernate.cfg.xml

On the final release schedule, Emmanuel indicated that Query and Index optimization are two areas where he sees some more work being done before 3.0 is released, and he concluded with:

The Hibernate Search core code is fairly stable actually. The main reason why it's marked as beta is because we are still unsure of some of the extension APIs, Hibernate Search core is fairly flexible and you can plug a bunch of custom strategies. While they have been fairly stable so far, we would like to have a feature complete product to be sure the API won't evolve and break.

You know the usual song. An open source project is released when it is done. All I can say is the the summer is long and I haven't planned much vacations :)

An interesting debate discussing the pros and cons of the Hibernate Search strategy has also begun, with Sanjiv Jivan describing good and bad points that he sees with Hibernate Search, and Emmanuel Bernard responding to Sanjiv's concerns. What is your viewpoint on Hibernate Search?

Rate this Article