Fix search index updates for AbstractFilterPages #8468
Merged
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.
We have a bug whereby AbstractFilterPage deletes (and, presumably, updates) don't get reflected in the filterable list search index. This happens because of some logic around Wagtail specific page types; see internal
https://github.local/Design-Development/Design-and-Content-Team/issues/471 for details.
Our current code hooks up Wagtail Page save/delete events to django-opensearch-dsl save/delete handlers but, before passing along the events, casts AbstractFilterPage instances to their specific page type. This prevents the d-o-d logic from actually updating the search index because it can't associate a specific page model type with any particular document/index.
With this change, we do two things:
Notes and todos
This approach does have one drawback which is that it prevents us from, theoretically, having some other d-o-d search index for a more specific page type. It would definitely be nicer if d-o-d supported inherited model types and thus knew to update the AbstractFilterPage index when a BlogPage is updated.
Checklist