Hibernate Search is a library that integrates Hibernate ORM with Apache Lucene or Elasticsearch by automatically indexing entities, enabling advanced search functionality: full-text, geospatial, aggregations and more. For more information, see Hibernate Search on hibernate.org.

It's been quite some time since the latest release of Hibernate Search, but since the code base has been fairly stable and bug free, we have been holding it until now. But there are some interesting features that could not wait anymore:

  • transparent reindexing on all collection changes
  • support of Lucene 2.3 (performance improvements and stability)
  • query ResultTransformer making projections even more friendly

Transparent reindexing on collection change

Finally! This one has been annoying some of you for some time now. If you use Hibernate 3.2.6, Hibernate Search will reindex the entities on collection change. Be sure to add the appropriate additional event listeners

        <event type="post-collection-recreate"/>
            <listener class="org.hibernate.search.event.FullTextIndexCollectionEventListener"/>
        </event>
        <event type="post-collection-remove"/>
            <listener class="org.hibernate.search.event.FullTextIndexCollectionEventListener"/>
        </event>
        <event type="post-collection-update"/>
            <listener class="org.hibernate.search.event.FullTextIndexCollectionEventListener"/>
        </event>

This event listeners configuration will transparently be done when Hibernate Annotations 3.3.1 is out (the code is checked in already).

Lucene 2.3

Hibernate Search now runs Lucene 2.3. Hibernate Search is fully backward compatible with Lucene 2.2 but we highly recommend you to move to Lucene 2.3 (included in the latest Hibernate Search distribution) as some interesting performance improvements have been done by the Lucene team (I know, they did it again).

Query ResultTransformers

Projection query is a useful tool in some performance critical situations but the returned result is List<Object[]>: needless to say, not very developer friendly.

ResultTransformer, already available in regular Hibernate Core queries to post process the results, can now be used in Hibernate Search queries.

FullTextQuery query = s.createFullTextQuery( query, Employee.class );
query.setProjection("id", "lastname", "department");
query.setResultTransformer( new AliasToBeanResultTransformer(EmployeeView.class) );
List<EmployeeView> results = (List<EmployeeView>) query.list();

And a few other bug fixes

Some additional bug fixes and enhancements have been introduced, including @IndexedEmbedded used in multiple levels, Hibernate Search filter caching actually cache now with the standard Lucene CachingWrapperFilter and so on.

The release can be downloaded here, the complete changelog can be found at here.

Enjoy


Back to top