Skip to content

Commit

Permalink
Fix select external by id
Browse files Browse the repository at this point in the history
  • Loading branch information
olovy committed Nov 30, 2021
1 parent d759e04 commit 2ff3472
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ class ExternalEntitiesSearchAPI extends HttpServlet {
}

List selectExternal(String iri, Collection<String> types) {
def typeFilter = typeFilter(types)
def theTypeFilter = typeFilter(types)

def inWhelk = whelk.getCards([iri])
if (inWhelk[iri]) {
return whelkResult(inWhelk[iri], typeFilter)
return whelkResult(inWhelk[iri], theTypeFilter)
}

return whelk.external.getEphemeral(iri).map ({ doc ->
def extId = doc.getThingIdentifiers().first()
inWhelk = whelk.getCards([extId])
if (inWhelk[extId]) { // iri was an alias/sameAs
return whelkResult(inWhelk[extId], typeFilter)
return whelkResult(inWhelk[extId], theTypeFilter)
}

if (typeFilter(types).test(doc)) {
if (theTypeFilter.test(doc)) {
whelk.embellish(doc)
[JsonLd.frame(doc.getThingIdentifiers().first(), doc.data)]
} else {
Expand Down

0 comments on commit 2ff3472

Please sign in to comment.