Added action to edited_term to sync posts when a term is edited #1956
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
When a term is edited, all related posts should be re-indexed. This is very important when it comes to term-based queries which happen pretty regularly on our platform.
Filters for skipping this process have also been added since at large affected-post counts, things tend to fail. We handle these occurrences in a separate queue system that asynchronously processes indexing jobs.
Props @nickdaugherty
cc @rinatkhaziev @pschoffer @netsuso @parkcityj
Alternate Designs
We didn't consider any other designs.
Benefits
Post data remains consistent with the database which keeps queries returning expected results.
Possible Drawbacks
The default behaviour is problematic when there are a lot of posts affected. We only do this behaviour for 10k or less posts and offload any indexing with counts above that to be processed asynchronously.
Verification Process
We noticed data inconsistencies when comparing posts from the DB against posts from ES when editing terms. After applying these changes, the index and the DB were consistent.
Checklist:
Applicable Issues
Changelog Entry
Added queuing of affected posts on term change. Props @nickdaugherty