Remove content from public facing Examine indexes when it is made protected #14415
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.
Prerequisites
Description
The public facing Examine indexes (i.e.
ExternalIndex
) filters out protected content when indexing on publish and when rebuilding (it happens here). However, if content is made protected subsequently to a publish or index rebuild, the content remains in the indexes.This PR ensures that content is removed from the applicable indexes when public access protection is applied.
Limitations
We have to leverage the public access cache refreshing notification to implement this, because we need to perform this task on every single server in a load balanced setup. Unfortunately, these notifications have been implemented rather sparsely, which limits what we can do with them.
At this time we can only remove content from the indexes when public access is added to content. We can't add content to the indexes when public access is removed from content.
To overcome this limitations, editors must republish the entire structure of the previously protected content after removing public access restrictions.
Testing this PR
You should probably start by rebuilding the
ExternalIndex
, to ensure you've got an accurate starting point.You also need a member group (members optional) to perform public access configuration.
ExternalIndex
contains all the content.ExternalIndex
no longer contains any item in the structure.ExternalIndex
once more contains all the content.