@ContainedIn triggers too much works when there is not "depth" on the corresponding @IndexedEmbedded

Description

When dealing with large entities with many indexed fields, we would like to use @IndexedEmbedded.includePath feature, as opposed to @IndexedEmbedded.depth, so that the set of embedded entities that trigger a full reindexing of the parent entity (because of a @ContainedIn) is minimal.
Unfortunately, it seems that when an entity is changed, Hibernate Search jumps from entity to entity based on the @ContainedIn annotations and on the @IndexedEmbbedded.depth feature. So, if @IndexedEmbedded.depth keeps its default value (which often is the case when using includePaths) it will ultimately jump to unnecessary entities.

This description probably isn't very clear, so here's a test case: https://github.com/hibernate/hibernate-search/pull/965

Important note: this bug also affects branch 4.5, which would greatly benefit from backporting the eventual fix.

Might be related:
Possible duplicate (not sure, since it's not the same version):

Environment

Any (test case provided)

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Major
Configure