Bidirectional Indexing in Hibernate Search 6

We have three entities - A, B and C.
A is the main entity annotaded with @Indexed.
A and B have a bidirectional connection via mappedBy.
The field change in a B Entity is correctly updated in the index.
The Problem is:
B and C have a unidirectional connection (B => C).
Changes to C are not updated in the index.

How can I solve this problem?
I am thankful for any help.


I’ll start with the obvious: you could make the association bi-directional. Of course that’s only an option if there are a reasonable number of Bs for any given C.

Apart from that, currently your only option would be to reindex A periodically (e.g. every night), to make the index catch up with changes on C. See the mass indexer.

Eventually we hope to address this use case more directly, as explained here: [HSEARCH-1937] Consider offering a query based approach to @ContainedIn - Hibernate JIRA
But there’s a lot of groundwork to do before we can even start doing that (mainly HSEARCH-2364).