Commit 2fcdab85 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix issue with field name.

parent 9776628b
......@@ -350,9 +350,9 @@ class DocumentsSearchDocBuilder(
.flatMap { it.toList() },
callNumber = Extract.typedEntityByType(physicalIdentifiers, "type", "callNumber", "identifier")
.flatMap { it.toList() },
accessInstitution = elasticSearchWrapper.getExtraInstitutionsFromRecordSet(recordSetId, "access"),
originalInstitution = elasticSearchWrapper.getExtraInstitutionsFromRecordSet(recordSetId, "original"),
masterInstitution = elasticSearchWrapper.getExtraInstitutionsFromRecordSet(recordSetId, "master"),
accessInstitution = elasticSearchWrapper.getExtraInstitutionsFromRecordSet(recordSetId, "accessInstitution"),
originalInstitution = elasticSearchWrapper.getExtraInstitutionsFromRecordSet(recordSetId, "originalInstitution"),
masterInstitution = elasticSearchWrapper.getExtraInstitutionsFromRecordSet(recordSetId, "masterInstitution"),
published = (record[Constants.isPublished] as Boolean?) ?: false,
suggest = suggestContainerBuilder.build()[0]
......
......@@ -230,21 +230,21 @@ class ElasticSearchWrapper(
val request = GetRequest(recordSetIndex, identifier)
val response = client.get(request, RequestOptions.DEFAULT)
if (response.isExists) {
when (val map = response.sourceAsMap["${extraType}Institution"]) {
when (val map = response.sourceAsMap[extraType]) {
is List<*> -> {
log.debug("Retrieval of '${extraType}Institution' was successful.")
log.debug("Retrieval of '$extraType' was successful.")
map.map { FacetContainer.fromMap(it) }
}
null -> {
log.error("Found record set for id $identifier in $recordSetIndex, but could not retrieve names in field '${extraType}Institution'.")
log.error("Found record set for id $identifier in $recordSetIndex, but could not retrieve names in field '$extraType'.")
emptyList()
}
is Map<*, *> -> {
log.debug("Retrieval of '${extraType}Institution' was successful.")
log.debug("Retrieval of '$extraType' was successful.")
listOf(FacetContainer.fromMap(map))
}
else -> {
log.error("Found record set for id $identifier in $recordSetIndex, but could not retrieve names in field '${extraType}Institution'.")
log.error("Found record set for id $identifier in $recordSetIndex, but could not retrieve names in field '$extraType'.")
emptyList()
}
}
......
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