From b2ee90c89f6b3a0b18a157de05ad8e523fb34fe3 Mon Sep 17 00:00:00 2001 From: Dave Martin Date: Tue, 13 Aug 2024 13:30:02 +0100 Subject: [PATCH] fixes and closes #1347 removing the escaping for ID matching --- .../java/life/catalogue/matching/index/DatasetIndex.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matching-ws/src/main/java/life/catalogue/matching/index/DatasetIndex.java b/matching-ws/src/main/java/life/catalogue/matching/index/DatasetIndex.java index 197aef300..b75dfe85a 100644 --- a/matching-ws/src/main/java/life/catalogue/matching/index/DatasetIndex.java +++ b/matching-ws/src/main/java/life/catalogue/matching/index/DatasetIndex.java @@ -433,7 +433,7 @@ private static String escapeQueryChars(String s) { } private Optional getByUsageKey(String usageKey) { - Query query = new TermQuery(new Term(FIELD_ID, escapeQueryChars(usageKey))); + Query query = new TermQuery(new Term(FIELD_ID, usageKey)); try { TopDocs docs = getSearcher().search(query, 3); if (docs.totalHits.value > 0) { @@ -600,6 +600,11 @@ private static ExternalID toExternalID(Document doc, Dataset dataset) { */ public NameUsageMatch matchByExternalKey(String key, Issue notFoundIssue, Issue ignoredIssue) { + NameUsageMatch usageMatch = matchByUsageKey(key); + if (usageMatch.getDiagnostics().getMatchType() != MatchType.NONE) { + return usageMatch; + } + // if join indexes are present, add them to the match if (identifierSearchers != null && !identifierSearchers.isEmpty()){ try {