Trigger reindexing when a property is modified, but not when the targeted entity is modified

Description

Relevant Search 5 test: org.hibernate.search.test.embedded.EmbeddedTest#testIndexedEmbeddedAndCollections. See the very last transaction, and the Product/Author association.

Consider this mapping:

Currently you can prevent a change to ShoppingList#content or Product#name from triggering reindexing of the ShoppingList by adding @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.NO to ShoppingList#content. It's actually the only way to have Hibernate Search accept this mapping, because there's no inverse side to that association.

But what if you want to reindex the shopping list when its content is modified? You cannot currently do that, as @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.NO will also disable reindexing when content is modified.

We should probably add a new value for ReindexOnUpdate, maybe SHALLOW, so that only updates that are part of the same entity trigger reindexing, but updates from another entity are ignored. That would probably be a more useful behavior than ReindexOnUpdate.NO in many cases.

Environment

None

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure