Repository navigation
[dtq-dev-93] Reindex the previous version after the latest version is deleted - #1773
Open
milanmajchrak wants to merge 1 commit into
Open
milanmajchrak wants to merge 1 commit into
milanmajchrak wants to merge 1 commit into
Conversation
With versioning.unarchive.previous.version = false the previous version stays archived, so deleting the latest version never reindexed it and it stayed out of search. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
References
New fix, not a port. dtq-dev has the same code and the same bug; this PR fixes only dtq-dev-93.
Upstream DSpace
mainhas the samedeleteVersionedItem()code. It has no bug there, because upstream always unarchives the previous version. There is no upstream fix to copy.Description
After the latest version of an item is deleted, the previous version now shows up in search right away. Before, it stayed hidden until someone edited it.
Instructions for Reviewers
List of changes in this PR:
DefaultItemVersionProvider.deleteVersionedItem():clarin-dspace.cfgsetsversioning.unarchive.previous.version = false, so the previous version stays archived when a new version is installed. Its Solr doc still getslatestVersion=false, because the install addsdc.relation.isreplacedbyto it and reindexes it. On delete, the existing code re-archives and updates the previous item only when it is not archived. So it was never reindexed. A newelsebranch fires a MODIFY event for the previous item, so Discovery reindexes it as the latest version. It does not write to the DB or changelastModified.DiscoveryVersioningIT.test_deleteLatestVersion_archivedPreviousVersionIsFoundAgainsets the property tofalse, creates and archives a second version, deletes it over REST, and checks that the first version is in the default search again.How to test:
mvn verify -pl dspace-server-webapp,dspace -am -DskipIntegrationTests=false -Dtest=none -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dit.test=DiscoveryVersioningIT. Without the change inDefaultItemVersionProviderthe new test fails onlatestVersionafter the delete.VersionRestRepositoryIT,VersionHistoryRestRepositoryIT,CanDeleteVersionFeatureIT,ItemServiceIT,ClarinVersionedHandleIdentifierProviderITandVersioningTeststill pass.Codex review (gpt-6.2-sol, high): no findings.
Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.🤖 Generated with Claude Code