Skip to content

MCR-3388 Duplicate Detection and handling - #1484

Open
sebhofmann wants to merge 4 commits into
mainfrom
issues/MCR-3388-Duplicate_Detection_and_handling
Open

MCR-3388 Duplicate Detection and handling#1484
sebhofmann wants to merge 4 commits into
mainfrom
issues/MCR-3388-Duplicate_Detection_and_handling

Conversation

@sebhofmann

Copy link
Copy Markdown
Member

Link to jira.

Uses the new mycore-dedup and mycore-dedup-gui components in MIR. Counterpart of MyCoRe-Org/mycore#3096, which has to be merged first.

There is no MIR ticket yet, so the branch and the commits carry the MyCoRe ticket.

What this does

Duplicate check during import (MIRImportServlet, xslt/duplicatecheck.xsl)

  • The import forms (content/publish/index.xml, content/publish/importPPN.xml) submit to MIRImportServlet instead of opening the editor directly.
  • The servlet builds the mycoreobject from the imported metadata, caches it in the session and asks dedup:duplicates-for-session:{key} for existing objects sharing a deduplication key.
  • Without hits it redirects straight to the editor, which loads the cached object via session:{key}.
  • With hits it renders a confirmation page listing the possible duplicates with the same object display as the search result list, together with title and identifier of the publication that is about to be imported, so the page has context on its own.
  • On confirmation the ids are written into the cached object as service flags of the type MCR.DeDup.NoDuplicateFlagType. The flags survive the editor and are turned into permanent no-duplicate markings by MCRDeDupNoDuplicateFlagEventHandler once the object is stored and has an id. The ids come from the session, not from the request, so only objects that were actually presented can be marked.

Duplicate management in the navigation

  • /dedup/ added to the contentadmin group of navigation.xml.
  • New facts based rules (rules/rules-dedup.xml) grant manage-deduplication and read access to webpage:/dedup/ to editors and administrators, rules-webpage.xml excludes the path from the public catch-all.
  • Old rule system covered as well: manage-deduplication in mir-cli/.../acl/permissions.xml, the webpage rule in webacl-commands.txt and in the wizard commands.

Notes

  • Existing installations have to run the new ACL commands manually, they only apply to new installations otherwise.
  • Whether the check should also run when an object is saved from the editor is still open, see the discussion in the MyCoRe PR.

Intercept the metadata import before the editor opens, check for possible duplicates via the mycore-dedup component and require explicit confirmation before continuing.

MIRImportServlet builds the imported object, caches it in the session and runs dedup:duplicates-for-session. When duplicates are found the duplicatecheck.xsl page shows them using the search result display (basketContent mode). The editor then loads the cached object from the session. Adds the mycore-dedup dependency, allows the mir.import. session key prefix and the i18n keys mir.import.dedup.* for de and en.
When the user confirms that none of the presented objects is a duplicate, the
imported object has no id yet, so the confirmation cannot be stored as a
no-duplicate marking. Instead one service flag per confirmed object id is added
to the cached object, using the flag type configured by
MCR.DeDup.NoDuplicateFlagType. MCRDeDupNoDuplicateFlagEventHandler turns those
flags into markings once the object is stored.

The confirmed ids are kept in the session instead of being passed through the
url, so that only objects this servlet has presented can be marked. The session
key of the imported object is now checked against its prefix before it is passed
on to the editor.
Link the duplicate management provided by mycore-dedup-gui from the content
admin group of the user menu. The entry is only shown to editors and
administrators: navigation items are filtered by the read permission of their
webpage id.

Grants the manage-deduplication permission checked by MCRDeDupVueServlet and
read access to webpage:/dedup/ in both access systems, so the rules are in place
for new installations via cli and wizard as well.
The page listing the possible duplicates gave no clue that it belongs to an
import the user started before. It now names the publication that is about to
be imported (title and identifier, taken from the object built by the servlet,
which is not stored yet and therefore cannot be rendered like the duplicates
below) and says so in title and intro text. The buttons name the import as
well, so that "continue" cannot be mistaken for anything else.

The mir.import.dedup.* keys were also sorted into the right place in both
message files.
@sebhofmann
sebhofmann marked this pull request as ready for review August 11, 2026 14:00
@yagee-de
yagee-de self-requested a review August 18, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants