POJO mapper annotations to configure backend-specific, index-scoped options

Description

The idea would be to allow users to configure index options through annotations, similarly to @Table in Hibernate ORM. But since most options are backend-specific, we would need backend-specific annotations.

Something like:

The Elasticsearch annotation (as well as the programmatic API equivalent) would live in a new module:

  • They should not be directly in the Pojo module because it would prevent externally implemented backends to have their own annotations (due to the lack of extension point).

  • They should not be directly in the Elasticsearch module because 1) it would require us to introduce annotations in the Backend SPI, which puts non-POJO mappers at a disadvantage (they would not benefit from this feature), and 2) it would require to add some indexConfiguration(Object) method in the programmatic API to pass an Elasticsearch-specific configuration object.

We will need a hibernate-search-orm-elasticsearch-starter Maven module to simplify dependency configuration, though.

Suggestion of implementation

Offer an SPI in the POJO mapper allowing to map annotations to "configurer" beans (much like what we do for bridges), and call a method on each configurer. Parameters passed to this methods would act as entry points to a programmatic API allowing to define index configuration. Something like this:

At some point in the future we might decide to promote this SPI to API, allowing users to define their own configurers.

Activity

Details

Assignee

Reporter

Components

Priority

Created August 30, 2018 at 1:18 PM
Updated September 25, 2023 at 2:48 PM