Quote:
What do you think?
Does it seem correct from a hibernate search point of view?
At the moment, I'm still having a hard-time seeing all the implications behind.
Yes that seems the way to go, assuming you're aware of the limitations I mention in the next paragraph (uniqueness of '#' and Date precision requirements).
Quote:
Also, for example, I don't totally understand why Hibernate Search does not provide default/automatic bridges for this use case. I mean technically it would quite easy to do a generic bridge for composite classes like this, using reflections it would then compose bridges for each basic types already covered, isn't it?.
It's not always straight-forward to map data to String and back. For example your solution will fail if your
codeActe happens to contain a "#"; we provide out-of-the-box conversions for many custom types, but combining them has some perils for which the user should best be aware of, and do some explicit choices, for example around required precision in Date conversions.
Quote:
As I know the level of the team is very high, I suppose it was not made on purpose.
Thank you :) but in this case I think we didn't think too much about it and we usually prefer to keep it simple than to apply too much magic.
In my opinion since mapping it properly could be problematic in practice, it's highly preferable that the API user is aware of how it works.
Quote:
Maybe for performance implications?
Yes, a bit; especially if you plan to involve reflection but also since the String format chosen for encoding should be as small as possible and so the representation depends on the content of the fields, and we can't guess the content from the type alone.
If you want to try creating a patch to implement such a feature, that could be a nice contribution to the code base, provided you add a couple of unit tests using a non-trivial composition to proof the flexibility of the idea.
Performance doesn't need to be a dominant factor in the design as people will always be able to override the default if needed, and would only need to care about in case the performance was really an issue, but I would dislike such a feature if it was going to fail in many common cases.