Use domain specific annotations to plug custom bridges
Description
is followed up by
relates to
required for
Activity

Yoann RodièreApril 25, 2018 at 7:50 AM
Mostly resolved as part of the Search 6 proof of concept groundwork.
See in particular the @TypeBridgeMapping
and @PropertyBridgeMapping
annotation, as well as the AnnotationBridgeBuilder
interface.
Followed up by HSEARCH-3135.

Yoann RodièreNovember 15, 2016 at 1:05 PM
I don't think the fact that the custom bridge writes into multiple fields would make a difference. The parameters are per bridge, not per field. After all, parameters are totally up to the user, and so are the resulting fields. They could have a list of annotations, one for each resulting field, if they wanted to:
On the other hand, some custom bridges may write to multiple fields without needing separate parameters for each field.
I'm also a bit concerned with requiring people to write their own annotations. It's really simple, but not very common, so it might put some users off. We could offer some kind of "simpler" annotation, similar to what we had before 6.0, to make it possible to opt out:
That would definitely be less powerful, though. And it could confuse users to have two ways of doing exactly the same thing. In the end, having a detailed example in the documentation might be a better solution.

Sanne GrinoveroNovember 15, 2016 at 11:20 AM
Ok that looks nice indeed. The only drawback I see is that I'm not sure how familiar people are with creating their own annotations, but it's very minor.
Would be interesting to explore a similarly declarative way for those bridges which need to write into multiple fields? After all what we need is for people to declare this upfront.

Yoann RodièreNovember 15, 2016 at 9:08 AM
I think it's about applying custom bridge using custom annotations, a bit like what is mentioned in HSEARCH-18. It would be close to how custom validation works in Hibernate Validator.
I think it would be a very, very nice way to implement the concept of "complex field bridge" we talked about (bridges that aren't just simple functions). We could introduce something like that in Hibernate Search 6:
MyCustomBridge.java
MyEntity.java
MyCustomBridgeImpl.java

Sanne GrinoveroAugust 6, 2014 at 2:46 PM
Time to undust this one. Could you elaborate, especially now that we're thinking of making these pluggable?
Details
Assignee
Yoann RodièreYoann RodièreReporter
Emmanuel BernardEmmanuel BernardComponents
Fix versions
Priority
Major
Details
Details
Assignee

Use annotated annotations to declare bridges. Ie offer the same flexibility used by HSearch in @DateBridge