Apply enabled/stock default filters on the incremental indexing path#157
Open
loevgaard wants to merge 1 commit into
Open
Apply enabled/stock default filters on the incremental indexing path#157loevgaard wants to merge 1 commit into
loevgaard wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## issue-111-remove-entity-document #157 +/- ##
======================================================================
+ Coverage 45.17% 45.72% +0.54%
- Complexity 734 748 +14
======================================================================
Files 131 133 +2
Lines 2406 2443 +37
======================================================================
+ Hits 1087 1117 +30
- Misses 1319 1326 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
df8d23f to
6952c4f
Compare
26b03ca to
5df71ee
Compare
Full and incremental indexing used inconsistent filter sets: the enabled and stock_available default filters only existed as query-builder subscribers (full reindex), while the incremental (Doctrine event) path only ran the tagged object filters, of which only channels_aware had an object-filter counterpart. So editing a disabled product re-added it, and disabling a product never removed it. - Ship EnabledEntityFilter and StockAvailableEntityFilter (object-filter counterparts of the query-builder subscribers), registered under the same per-index default_filters toggles as the subscribers. - In DefaultIndexer::indexEntities(), when an entity fails the object filter, remove its document from that scope's index (batched per scope) instead of silently skipping it. Disabling or de-stocking a product now removes it from search on its next save. Closes #112
6952c4f to
be49d96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Full reindexing and incremental (Doctrine event) indexing used two different, inconsistent filter sets. The
enabled/stock_availabledefault filters only existed as query-builder subscribers (which run during full reindex), while the incremental path only ran the object filters taggedsetono_sylius_meilisearch.entity_filter— of which onlychannels_awarehad an object-filter counterpart. Consequences:Two parts:
EnabledEntityFilterandStockAvailableEntityFilter(the object-filter counterparts of theenabled/stock_availablequery-builder subscribers), registered under the same per-indexdefault_filterstoggles as the subscribers — so the incremental path applies the same rules as the full reindex.DefaultIndexer::indexEntities(), when an entity fails the object filter, its document is removed from that scope's index (batched per scope) instead of being silently skipped. So "disable a product" (or de-stock it) actively removes it from search on the very next save.Full reindex already routes through
indexEntities, but its entities are pre-filtered by the query-builder subscribers, so the object filters are consistent and no spurious deletes occur (verified: the functionalSearchTeststill passes).Testing
EnabledEntityFilterTest/StockAvailableEntityFilterTest: full logic incl. other-index scopes, non-toggleable/non-product entities, untracked vs out-of-stock variants, no-variant products.DefaultIndexerTest::it_removes_a_filtered_out_entity_from_the_index: a filtered-out entity triggersdeleteDocuments([id]).Closes #112
Stacked on #156 (#111).