Closed pschoffer closed 2 years ago
Upstream change: https://github.com/10up/ElasticPress/pull/2862
Hopefully we can get the upstream change in https://github.com/10up/ElasticPress/pull/2862 and then pull that in instead.
I checked with 10up and they plan to merge the upstream PR next week. The code has quite diverged there so it can't be cleanly cherry-picked, but I try to sync it as much as I could. This is now ready I think.
Description
When meta key is deleted from a post, this does NOT trigger reindex of that post due to the way of allowed metas are detected.
This change makes it so that we have the logic that evaluates if given meta_key is allowed separate from the logic that prepares metas for indexing. That way we can trigger even for meta key that is not being prepared to indexed (because it was just deleted) but is allowed to be in index (was in the indexed document before).
Checklist
Please make sure the items below have been covered before requesting a review:
Steps to Test
1) Add this filter impl:
2) Add meta -
vip dev-env exec -- wp post meta set 1 testing foobar
3) Check the document in ES -vip dev-env exec -- wp vip-search documents get post 1 --format=json | jq '.[0].meta'
4) Remove metavip dev-env exec -- wp post meta delete 1 testing
5) Check the document in ES -vip dev-env exec -- wp vip-search documents get post 1 --format=json | jq '.[0].meta'