Hibernate Search 4.1 CR3

Posted by    |       Hibernate Search

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.

Another CR for Hibernate Search 4.1 is ready! Even being in candidate release phase, we introduced something more than the usual minor bugfixes, as the following improvements are too nice to delay and technically not very risky.

Depending on Hibernate 4.1

Hibernate Search was updated to work with Hibernate ORM 4.1, as it was still using 4.0.

Rethinking the JGroups integration

The JGroups Channel is the communication transport used when connecting multiple nodes in cluster using JGroups; before 4.1.0.CR3, Hibernate Search would expect you to configure a Channel for each clustered index, but having to configure multiple JGroups Channel is tedious: for example, each channel should use a different set of network ports.

The Channel is now a service shared across all indexes: every index configured to use JGroups will share the same Channel instance. This simplifies configuration, network administration and speeds up initialization.

Configuration details are described in the JGroups configuration paragraph.

If you were using JGroups before, please see the Migration Guide.

JGroups channel injection

It is now possible to have Hibernate Search use an existing JGroups Channel, injecting the instance in the configuration. This was primarily introduced for other frameworks integrating our search engine, such as CapeDwarf, so they can control the Channel lifecycle and make use of alternative initialization options. Remember however: Search installs it's own message Receiver, it's not going to share the channel with other services!

import org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider;

org.jgroups.JChannel channel = ...//initialize or lookup the channel directly
Map<String,String> properties = new HashMap<String,String>();
properties.put( JGroupsChannelProvider.CHANNEL_INJECT, channel );
properties.put( //...other options
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "userPU", properties );

Plans for next...

We're working as well on making the master/slave an automatic election process, but that's too big of a change for a CR, so consider it just a teaser for upcoming 4.2 ! Of course, you can help starting to test it today if you're willing to participate in the coding and try the bleeding edge.


Back to top