Commit eae213bd authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Records sets an be held by multiple institutions.

parent 395317d1
Pipeline #23867 passed with stages
in 4 minutes and 59 seconds
......@@ -24,6 +24,7 @@ import ch.memobase.rdf.NS
import ch.memobase.rdf.RDA
import ch.memobase.rdf.RICO
import ch.memobase.rdf.RICO.Types.RecordSet
import com.beust.klaxon.JsonArray
import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager
import org.memobase.helpers.Date
......@@ -114,8 +115,15 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
}
val uri = recordSet[KEYS.entityId] as String
val id = uri.substringAfterLast("/")
val institution = recordSet[RICO.heldBy.localName] as String
val institutionId = institution.substringAfterLast("/")
val institutions = when (val value = recordSet[RICO.heldBy.localName]) {
is String -> listOf(value)
is JsonArray<*> -> value as List<String>
else -> {
log.error("No institutions found for record set $id.")
emptyList()
}
}
val institutionIds = institutions.map { it.substringAfterLast("/") }
val description = extractLanguageContainer(recordSet[RICO.descriptiveNote.localName], "")
val rights = extractLanguageContainer(recordSet[RICO.conditionsOfUse.localName], "")
......@@ -142,7 +150,7 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
}
},
periodOfTimeAsYear = date,
institution = elasticSearchWrapper.getInstitutionName(institutionId),
institution = institutionIds.map { elasticSearchWrapper.getInstitutionName(it) },
supportedByMemoriav = recordSet[KEYS.sponsoredBy] != null,
name = name,
documentType = elasticSearchWrapper.getDocumentTypesFromRecords(id, KEYS.QueryFields.recordSetFacet),
......
......@@ -37,7 +37,7 @@ data class RecordSetSearchDoc(
val periodOfTimeAsYear: IntegerRange?,
val supportedByMemoriav: Boolean,
val languageOfMetadata: List<FacetContainer>,
val institution: FacetContainer,
val institution: List<FacetContainer>,
// Sort
val lastUpdatedDate: String,
......@@ -86,11 +86,7 @@ data class RecordSetSearchDoc(
facet = emptyList()
)
),
institution = FacetContainer(
LanguageContainer.placeholder("TEST INSTITUTION"),
filter = "INSTITUTION_IDENTIFIER",
facet = emptyList()
),
institution = emptyList(),
periodOfTimeAsYear = IntegerRange(2000, 2020),
lastUpdatedDate = "2020-11-20T10:29:01.128",
keyVisualLink = "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-10/1.jpg?itok=5ncVBnVQ",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment