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.

We just published Hibernate Search 6.0.0.Beta7.

This release mainly improves sorts and aggregations on multi-valued or nested fields, introduces dynamic index fields through field templates, restores the index metamodel, and restores low-level Lucene settings. It also includes an upgrade to Hibernate ORM 5.4.15.Final.

Getting started with Hibernate Search 6

If you want to dive right into the new, shiny Hibernate Search 6, a good starting point is the getting started guide included in the reference documentation.

Hibernate Search 6 APIs differ significantly from Hibernate Search 5.

For more information about migration and what we intend to do to help you, see the migration guide.

What’s new

Better sorts and aggregations on multi-valued/nested fields

As of Hibernate Search 6.0.0.Beta7, aggregations in the Lucene backend now work correctly on multi-valued fields (HSEARCH-1927, HSEARCH-1929) and on fields in nested documents (HSEARCH-3892).

What’s more, both sorts and aggregations now support filtering when the field being sorted/aggregated on is located in a nested document (HSEARCH-3846, HSEARCH-3881). This is particularly useful to sort on a field that is usually multi-valued, but becomes single-valued after you apply the criteria of your query. Think of a search on t-shirts, sorting by price, where each t-shirt has multiple sizes with its own price; when searching for a specific t-shirt size, you’ll want to sort on the price of each t-shirt for that size only. See the reference documentation for details and examples: here for sorts and here for aggregations.

Many thanks to Waldemar Kłaczyński for providing the groundwork that made this possible.

Dynamic index fields through field templates

As of HSEARCH-3273, it is now possible to add fields to documents even if they weren’t declared beforehand, provided you declared matching field templates.

This means you can implement a bridge that will index a schema-less JSON object, for example, provided the properties of JSON objects are named following specific conventions that you can set yourself (such as *_int for integers, *_txt for text, etc.).

You can declare field templates by defining custom bridges; see this section of the reference documentation for more information.

Index metamodel

As of HSEARCH-3589, Hibernate Search exposes a metamodel for its indexes, effectively allowing to look up fields of a specific index and their characteristics. See this section of the reference documentation for more information.

Low-level configuration for the Lucene backends

As of HSEARCH-3776, several low-level configuration options relating to the Lucene IndexWriter have been restored. See here for index writer settings and here for merge settings.

As of HSEARCH-3777, the Similarity used when indexing and searching in the Lucene backend can be configured through the LuceneAnalysisConfigurer.

Version upgrades

Hibernate Search 6 requires ORM 5.4.4.Final or later to work correctly. Earlier 5.4.x versions will not work correctly.

Backward-incompatible changes

  • HSEARCH-3898: SearchQuery.explain(String, String) now expects to be passed the name of a mapped type, instead of the name of an index.

Documentation

  • HSEARCH-3887: The documentation no longer incorrectly states that routing keys don’t trigger filtering.

  • HSEARCH-3879: Configuration options related to thread pools and indexing are now explained more clearly.

Other improvements and bug fixes

  • HSEARCH-3886: Documents with missing values are now sorted last by default in sorts by field value, instead of being inserted next to "zero" values.

  • HSEARCH-3896: Calling .fetch on the same SearchQuery multiple times now works correctly.

  • HSEARCH-3897 and HSEARCH-3898: explain() now works correctly for indexes with a custom name; when the query targets multiple types, you should pass the JPA type name instead of the index name.

  • HSEARCH-3901: The context passed to PropertyMappingAnnotationProcessor/TypeMappingAnnotationProcessor now exposes an annotatedElement() method to inspect the annotated element (type, name and annotations).

  • HSEARCH-3911: LuceneSearchResult now exposes a getTopDocs() method.

  • HSEARCH-3914: LuceneSearchQuery now exposes a getLuceneSort() method.

And more. For a full list of changes since the previous releases, please see the release notes.

How to get this release

All details are available and up to date on the dedicated page on hibernate.org.

Feedback, issues, ideas?

To get in touch, use the following channels:


Back to top