From 78e27e6e10462e51cc20a9118fa09e14b5b3efc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olov=20Ylinenp=C3=A4=C3=A4?= <51744858+olovy@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:08:42 +0100 Subject: [PATCH] Do linkFinder.normalizeIdentifiers in RemoteSearchAPI (#1344) After conversion from MARC the documents might contain entities with both `@id` and data ``` "language": { "@id": "https://id.kb.se/language/eng", "code": "eng" } ``` This trips up Embellisher which doesn't see it as a link (`@id` and size == 1). So https://id.kb.se/language/eng is not added to embellish data. The same thing then happens in the cataloging interface, so the definition for English is not fetched there by `addMissingLinksToQuoted` either. This leads to a chip with the URI instead of the label in the form for the imported record. --- rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy b/rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy index ea398338f4..8626e3213f 100644 --- a/rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy +++ b/rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy @@ -12,6 +12,7 @@ import whelk.IdGenerator import whelk.Whelk import whelk.converter.MarcJSONConverter import whelk.converter.marc.MarcFrameConverter +import whelk.filter.LinkFinder import whelk.util.LegacyIntegrationTools import whelk.util.PropertyLoader import whelk.util.WhelkFactory @@ -39,6 +40,7 @@ class RemoteSearchAPI extends HttpServlet { final String DEFAULT_DATABASE = "LC" private Whelk whelk + private LinkFinder linkFinder private Set m_undesirableFields private Set m_undesirableFieldsAuth @@ -54,6 +56,7 @@ class RemoteSearchAPI extends HttpServlet { whelk = WhelkFactory.getSingletonWhelk() } marcFrameConverter = whelk.getMarcFrameConverter() + linkFinder = new LinkFinder(whelk.storage) m_undesirableFields = new HashSet<>() @@ -346,6 +349,7 @@ class RemoteSearchAPI extends HttpServlet { log.trace("Marcframeconverter done") Document doc = new Document(jsonDoc) + linkFinder.normalizeIdentifiers(doc); whelk.normalize(doc) whelk.embellish(doc) results.addHit(doc)