Search index syncs too many elements
- Dominant language
- Java
- Stars
- 593
- Forks
- 123
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 4
Description
# Problem
When calling the [/search/sync](https://getmesh.io/docs/api/#panel_search_sync) endpoint, sometimes too many elements are synced.
The issue was first found in the [BasicIndexSyncTest#testTagSync](https://github.com/gentics/mesh/blob/f8ea6f1ecf7ecf39f9606b3341927f262943efc8/core/src/test/java/com/gentics/mesh/search/index/BasicIndexSyncTest.java#L164) which tests the search index synchronization of tags. The last part of the test asserts that only one item is deleted in the search index after one tag is deleted.
However, the behaviour is currently vendor specific. To check if a tag has changed, the version of the tag family is compared (see [TagTransformer#generateVersion](https://github.com/gentics/mesh/blob/a4626001add1df4638c9a85f34ad30d197aebada/elasticsearch/src/main/java/com/gentics/mesh/search/index/tag/TagTransformer.java#L28)). The version currently depends on the database version of the vertex. In OrientDB this version is updated when an edge to that vertex is added or removed. Because of this, the deletion of the tag causes a new version of the tag family vertex, which causes all tags of that tag family to be marked for synchronization.
# Solution
Create our own vendor indepenedent versions of all vertices
Contributor guide
Assessment
This issue has not been assessed yet.