Permission indexing creates unused, orphan perm docs for unchanged files in draft versions #12094
+345
−164
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 this PR does / why we need it: At some point, content indexing was updated such that files in a released version, whose metadata has not changed in a draft version, are no longer indexed in the draft version (so you could still find the file from the released version, but would not know it existed in a newer draft as well from the search results alone - a minor inconvenience to avoid doubling the cost of indexing files when new drafts are created.)
However, permission indexing was not updated to match and thus, when permissions are indexed, files in this situation get perm docs for both the released version (where a matching content doc exists) and the draft version (where no content doc has been created). This PR fixes that and uses the same approach in permission indexing to not perm reindex files if their metadata does not change.
Which issue(s) this PR closes:
Special notes for your reviewer: The PR builds on #12082 and #12093 which can hopefully be merged first. The final fix here is relatively straight forward - just ~reusing the existing logic from the content indexing - I did change the query to return file ids rather than filemetadata ids since we don't have easy access to the filemetadata ids on the permission side due to earlier optimizations.
Suggestions on how to test this: Primarily regression testing - visible indexing and search shouldn't change. The one effect that can be seen is that there will no longer be perm docs for a files in a post-release draft version that don't have metadata changes. That can be seen via the Solr console/direct query to Solr.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: