Fix deleted Authors persisting in Solr index #861
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.
Closes #628
And may help with other Author search issues...
Description:
Turns out there was a bug where
update_author()
created its own string format delete messages for author deletes in Solr (for redirects, deletes, and blank author names). It was sending an incorrect key:OL...A
instead of the key indexed in Solr:/authors/OL...A
This means that redirected or deleted authors were not being removed from search, and explains why the deletes appeared to be failing silently but not showing up in logs. There seems to be a way for the authors to be removed correctly if they were reindexed as a result of an edition or work change , which explains why it looked like some updates would work, but it was hard to pin down why. More investigation is needed, We should add some logging to alert if a Solr update does not affect any documents in Solr.
This was a whole lot easier to debug after #804 I was able to reproduce the issue in dev, and use tests to ensure the correct behaviour. Thanks @cdrini for the refactoring and docstrings, and @mekarpeles for the production logs! I have been chasing this issue for ages, its great to have it finally pinned down!