IQSS/11113 fix file perm doc creation #11114
Open
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: This PR adds a check in the indexing code to only create a file permission doc in solr only for the datasetversions the file is in.
Which issue(s) this PR closes:
Special notes for your reviewer: As the note in the code suggests, there are cleaner ways to do this but since this is a relatively rare case (indexing when there is a currently draft version where a file has been added/dropped) I'm not sure refactoring to get more efficiency is worth the effort. (Not to say that adding/removing files is rare, but having two versions to index only occurs while there is a draft and presumably a draft like this doesn't often stay around forever, so I'm guessing this affects only a small number of files per index run. With the bug, the orphan perm docs do accumulate over time though, so fixing the bug somehow is worthwhile.)
Suggestions on how to test this: Create a dataset(s), where the draft version has files not in the original published version or vice versa. Then run /api/admin/index/status and you should see orphaned perm docs (docs in solr but not in the db). After the PR, this should not happen. (If you use the same solr, run /api/admin/index/clear-orphans and either edit the dataset to cause reindexing or just reindex it via the api.)
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?: included
Additional documentation: