When using Hibernate ORM multi-tenancy and `Session.merge()` on a child entity of one marked with `@Indexed`, the tenant information is lost in the Lucene index, making the `@Indexed` entity not appear in search results.
This seems to happen when the entity being merged has a collection of entities with a newly added child in it. If the merged entity's child collection has not changed or if it has children removed, the tenant information in the Lucene index seems preserved.
I've created a test case here (it could probably be even simpler):
[https://github.com/austalakov/hibernate-test-case-templates/tree/master/search/hibernate-search-lucene|https://github.com/austalakov/hibernate-test-case-templates/tree/master/search/hibernate-search-lucene|smart-link]
A work-around would be appreciated (or a pointer to what is wrong with the use case). The corresponding SO post: [ https://stackoverflow.com/questions/57146004/hibernate-search-not-returning-results-on-newly-created-entities |https://stackoverflow.com/questions/57146004/hibernate-search-not-returning-results-on-newly-created-entities] |
|