Do not reindex when irrelevant changes occur inside embedded objects

Description

Whenever an entity is modified and something changes in an embedded object, Hibernate ORM will trigger an event that mentions “that embedded object changed”, but it won't tell us *what* changed exactly inside that embeddable (org.hibernate.event.spi.PostUpdateEvent#dirtyProperties contains the index of the embeddable property, nothing more).

As a result, if the indexing of an entity depends on one property (P1) inside an embeddable, and another property (P2) in that embeddable changes, Hibernate Search currently has to reindex the entity “just to be safe”, because it doesn’t know whether P1 changed or P2 changed, just that “either P1 or P2 changed”. In short, we’ll reindex more often than necessary.

This is actually a limitation of Hibernate ORM, so we should investigate whether we can improve things in Hibernate ORM itself. Maybe it’s already solved in Hibernate ORM 6? I doubt that, though.

Activity

Yoann RodièreOctober 12, 2022 at 12:14 PM

I had to work around that in some tests for . Look for the key of this ticket (4718) in the source code to find reproducers.

Details

Assignee

Reporter

Components

Priority

Created October 12, 2022 at 12:11 PM
Updated September 25, 2023 at 2:48 PM