Whenever an indexed object becomes dirty, the entire related object graph gets reindexed. This can lead to a lot of unwanted database reads, especially with extra lazy collections, this can be a problem.
In order to prevent this, an index UPDATE could be executed in such a way that the existing Document gets read from the index and only the dirty fields get added/overwritten.
This would be a lot faster.
This scenario assumes very simply that whatever exists in the index as a Document is accurate as it is based on a previous index operation. Only the dirty fields are added.
This might not be ideal as a default (although to me it seems so), so I propose to add this option as an IndexingOverride. This way, a developer can create an indexing interceptor and add this option in the onUpdate and onCollectionUpdate methods.
|