The release 5.0.0.Alpha2 is now available on our shiny new website: as the alpha1 release also did, it integrates with Apache Lucene 4.6.1, but now we do it better ;-)
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.0.0.Alpha2</version>
</dependency>
More Like This queries
New features!
A More Like This
query is a special kind of query which takes a model document as an input, rather than a traditional string. It has been available for you to use since a long time via Lucene's MoreLikeThis Query implementation, but this implementation was rather tricky to use on our richer entity based model. Hibernate Search now provides direct support for this functionality via our Query builder DSL, and in its simplest form looks like this:
Coffee exampleCoffee = ...
QueryBuilder qb = fullTextSession.getSearchFactory()
.buildQueryBuilder()
.forEntity( Coffee.class )
.get();
Query mltQuery = qb
.moreLikeThis()
.comparingAllFields()
.toEntity( exampleCoffee )
.createQuery();
List results = fullTextSession
.createFullTextQuery( mltQuery, Coffee.class )
.list();
What does it do? It returns a list of Coffee instances which are similar to the exampleCoffee instance. The definition of similar
is as usual controlled by the analyzers and indexing options you choose. By default the list is of course ordered according to the scoring model, so the top match would be the example entity itself (this might be surprising but is often useful in practice).
A more extensive blogpost about this will follow, but if you can't wait to learn more see all details in the Building queries chapter.
Faceting improvements
One of the highest voted improvement requests on JIRA, it is now finally possible to facet on embedded collections. Hardy also started exploring possible performance improvements, and how to use the new Lucene 4 features: feedback, use cases or patches would be very welcome as we're eager to improve faceting more.
Watch the migration guide
If you're updating an application from previous versions of Hibernate Search, we highly recommend to keep an eye on the Migration Guide as the changes in the Lucene API are significant and not always self-documenting. Suggestions for the migration guide are also very welcome.
The Apache Lucene Migration Guide might also be useful, but we applied most of it already to the internal engine for you to use transparently.
The hibernate-search-analyzers module is removed
This module was created years ago when we had to fork some Lucene code to allow an easy migration path, but is now since long an empty module just depending on various commonly used analyzers. It's time for spring cleaning of dependencies, so the no longer needed module is removed: if you where using it, just remove it from your project and include a direct dependency to the analyzers you need from the Apache Lucene ecosystem.
What's next?
You can find an high level overview on our Roadmap page, or check the fine grained break down on this JIRA filter. Essentially we're aiming now at OSGi compability and at usability improvements which had to be postponed to a major release.