Skip to content

Commit 78e27e6

Browse files
authored
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.
1 parent aaae7b5 commit 78e27e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import whelk.IdGenerator
1212
import whelk.Whelk
1313
import whelk.converter.MarcJSONConverter
1414
import whelk.converter.marc.MarcFrameConverter
15+
import whelk.filter.LinkFinder
1516
import whelk.util.LegacyIntegrationTools
1617
import whelk.util.PropertyLoader
1718
import whelk.util.WhelkFactory
@@ -39,6 +40,7 @@ class RemoteSearchAPI extends HttpServlet {
3940
final String DEFAULT_DATABASE = "LC"
4041

4142
private Whelk whelk
43+
private LinkFinder linkFinder
4244

4345
private Set<String> m_undesirableFields
4446
private Set<String> m_undesirableFieldsAuth
@@ -54,6 +56,7 @@ class RemoteSearchAPI extends HttpServlet {
5456
whelk = WhelkFactory.getSingletonWhelk()
5557
}
5658
marcFrameConverter = whelk.getMarcFrameConverter()
59+
linkFinder = new LinkFinder(whelk.storage)
5760

5861
m_undesirableFields = new HashSet<>()
5962

@@ -346,6 +349,7 @@ class RemoteSearchAPI extends HttpServlet {
346349
log.trace("Marcframeconverter done")
347350

348351
Document doc = new Document(jsonDoc)
352+
linkFinder.normalizeIdentifiers(doc);
349353
whelk.normalize(doc)
350354
whelk.embellish(doc)
351355
results.addHit(doc)

0 commit comments

Comments
 (0)