Allow the use of native field types in ValueBridge

Description

Currently we only allow standard types in value bridges: org.hibernate.search.mapper.pojo.bridge.binding.impl.ValueBindingContextImpl#setBridge(java.lang.Class<V2>, org.hibernate.search.mapper.pojo.bridge.ValueBridge<V2,F>, org.hibernate.search.engine.backend.types.dsl.StandardIndexFieldTypeOptionsStep<?,F>) expects a standard step. But most extended steps such as asNative(String) in Elasticsearch do not return a standard step, because they don't allow setting doc values or anything.

We could relax the constraints and allow all steps extending IndexFieldTypeFinalStep to be passed to setBridge. If they extend IndexFieldTypeConverterStep, we will set the converters automatically, otherwise we won't do anything.

Annotations such as @GenericField or @FullTextField also require the step to extend a certain interface. We could relax constraints here too:

  • Either we delay the cast until attributes from the annotations are actually set, so that annotations can be used as long as you don't set any attribute

  • Or (maybe better?) we introduce a separate @NonStandardField annotation that doesn't expose any attribute except the field name and value bridge. (maybe find a better name for the annotation?).

Environment

None

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure