Skip to content

Commit

Permalink
Do linkFinder.normalizeIdentifiers in RemoteSearchAPI (#1344)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
olovy authored Nov 29, 2023
1 parent aaae7b5 commit 78e27e6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rest/src/main/groovy/whelk/rest/api/RemoteSearchAPI.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -39,6 +40,7 @@ class RemoteSearchAPI extends HttpServlet {
final String DEFAULT_DATABASE = "LC"

private Whelk whelk
private LinkFinder linkFinder

private Set<String> m_undesirableFields
private Set<String> m_undesirableFieldsAuth
Expand All @@ -54,6 +56,7 @@ class RemoteSearchAPI extends HttpServlet {
whelk = WhelkFactory.getSingletonWhelk()
}
marcFrameConverter = whelk.getMarcFrameConverter()
linkFinder = new LinkFinder(whelk.storage)

m_undesirableFields = new HashSet<>()

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 78e27e6

Please sign in to comment.