diff --git a/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java b/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java index 0b06739fce..84c49ce7fd 100644 --- a/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java +++ b/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java @@ -93,9 +93,10 @@ public void accept(Name n) { total++; Integer oldId = n.getNameIndexId(); NameMatch m = ni.match(n, allowInserts, false); - - if (!Objects.equals(oldId, m.getName().getKey())) { - nm.updateMatch(datasetKey, n.getId(), m.getName().getKey(), m.getType()); + + Integer newKey = m.hasMatch() ? m.getName().getKey() : null; + if (!Objects.equals(oldId, newKey)) { + nm.updateMatch(datasetKey, n.getId(), newKey, m.getType()); if (updateIssues) { IssueContainer v = n.getVerbatimKey() != null ? vmGet.getIssues(key.id(n.getVerbatimKey())) : null; if (v != null) {