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

Add additional fields to record set index.

parent 44bc574c
Pipeline #23885 passed with stages
in 5 minutes
...@@ -22,6 +22,7 @@ import ch.memobase.rdf.DC ...@@ -22,6 +22,7 @@ import ch.memobase.rdf.DC
import ch.memobase.rdf.MB import ch.memobase.rdf.MB
import ch.memobase.rdf.NS import ch.memobase.rdf.NS
import ch.memobase.rdf.RDA import ch.memobase.rdf.RDA
import ch.memobase.rdf.RDF
import ch.memobase.rdf.RICO import ch.memobase.rdf.RICO
import ch.memobase.rdf.RICO.Types.RecordSet import ch.memobase.rdf.RICO.Types.RecordSet
import com.beust.klaxon.JsonArray import com.beust.klaxon.JsonArray
...@@ -53,12 +54,22 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW ...@@ -53,12 +54,22 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
var relatedRecordSets = LanguageContainer.EMPTY var relatedRecordSets = LanguageContainer.EMPTY
var publicationTitles = LanguageContainer.EMPTY var publicationTitles = LanguageContainer.EMPTY
var relatedDocumentTitles = LanguageContainer.EMPTY var relatedDocumentTitles = LanguageContainer.EMPTY
val originalCallNumbers = mutableListOf<String>()
val originalIdNumbers = mutableListOf<String>()
val accessInstitutions = mutableListOf<FacetContainer>() val accessInstitutions = mutableListOf<FacetContainer>()
val masterInstitutions = mutableListOf<FacetContainer>()
val originalInstitutions = mutableListOf<FacetContainer>()
input.values.forEach { input.values.forEach {
when { when {
it[RICO.type.localName] == KEYS.LanguageType.metadata -> { it[RICO.type.localName] == KEYS.LanguageType.metadata -> {
metadataLanguages.add(it) metadataLanguages.add(it)
} }
it[KEYS.atType] == RICO.Identifier.uri && it[RICO.type.localName] == KEYS.IdentifierType.callNumber -> {
originalCallNumbers.add(it[RICO.identifier.localName] as String)
}
it[KEYS.atType] == RICO.Identifier.uri && it[RICO.type.localName] == KEYS.IdentifierType.original -> {
originalIdNumbers.add(it[RICO.identifier.localName] as String)
}
it[KEYS.atType] == RICO.Title.uri && it[KEYS.atType] == RICO.Title.uri &&
it[RICO.type.localName] == KEYS.TitleTypes.original -> { it[RICO.type.localName] == KEYS.TitleTypes.original -> {
originalTitles = originalTitles.add(it[RICO.title.localName]) originalTitles = originalTitles.add(it[RICO.title.localName])
...@@ -84,6 +95,20 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW ...@@ -84,6 +95,20 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
val names = elasticSearchWrapper.getInstitutionName(id) val names = elasticSearchWrapper.getInstitutionName(id)
accessInstitutions.add(names) accessInstitutions.add(names)
} }
it[KEYS.atType] == RICO.RecordResourceHoldingRelation.uri
&& it[RICO.type.localName] == RICO.Types.RecordResourceHoldingRelation.master -> {
val value = it[RICO.recordResourceHoldingRelationHasSource.localName] as String
val id = value.substringAfterLast("/")
val names = elasticSearchWrapper.getInstitutionName(id)
masterInstitutions.add(names)
}
it[KEYS.atType] == RICO.RecordResourceHoldingRelation.uri
&& it[RICO.type.localName] == RICO.Types.RecordResourceHoldingRelation.original -> {
val value = it[RICO.recordResourceHoldingRelationHasSource.localName] as String
val id = value.substringAfterLast("/")
val names = elasticSearchWrapper.getInstitutionName(id)
originalInstitutions.add(names)
}
} }
} }
// related record sets which are present in memobase. // related record sets which are present in memobase.
...@@ -185,7 +210,11 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW ...@@ -185,7 +210,11 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
relatedDocuments = relatedDocumentTitles, relatedDocuments = relatedDocumentTitles,
dataImport = dataImport, dataImport = dataImport,
accessInstitution = accessInstitutions, accessInstitution = accessInstitutions,
teaserTest = teaserText originalInstitution = originalInstitutions,
masterInstitution = masterInstitutions,
teaserTest = teaserText,
originalIdNUmber = originalIdNumbers,
originalCallNumber = originalCallNumbers
) )
} }
......
...@@ -58,8 +58,12 @@ data class RecordSetSearchDoc( ...@@ -58,8 +58,12 @@ data class RecordSetSearchDoc(
val relatedPublications: LanguageContainer?, val relatedPublications: LanguageContainer?,
val relatedDocuments: LanguageContainer?, val relatedDocuments: LanguageContainer?,
val dataImport: LanguageContainer?, val dataImport: LanguageContainer?,
val originalCallNumber: List<String>,
val originalIdNUmber: List<String>,
// Support Field (required to be indexed in the record). // Support Field (required to be indexed in the record).
val originalInstitution: List<FacetContainer>,
val masterInstitution: List<FacetContainer>,
val accessInstitution: List<FacetContainer> val accessInstitution: List<FacetContainer>
) : Schema(recordSetId) { ) : Schema(recordSetId) {
...@@ -107,9 +111,11 @@ data class RecordSetSearchDoc( ...@@ -107,9 +111,11 @@ data class RecordSetSearchDoc(
relatedDocuments = LanguageContainer.placeholder(placeholderTitle), relatedDocuments = LanguageContainer.placeholder(placeholderTitle),
dataImport = LanguageContainer.placeholder(lorem), dataImport = LanguageContainer.placeholder(lorem),
accessInstitution = emptyList(), accessInstitution = emptyList(),
teaserTest = LanguageContainer.placeholder(lorem) teaserTest = LanguageContainer.placeholder(lorem),
masterInstitution = emptyList(),
originalCallNumber = emptyList(),
originalInstitution = emptyList(),
originalIdNUmber = emptyList()
) )
} }
} }
\ No newline at end of file
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