Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Elasticsearch Services
Search Doc Service
Commits
f51b9747
Commit
f51b9747
authored
Mar 26, 2021
by
Jonas Waeber
Browse files
Add additional fields to record set index.
parent
44bc574c
Pipeline
#23885
passed with stages
in 5 minutes
Changes
3
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/RecordSetSearchDocBuilder.kt
View file @
f51b9747
...
...
@@ -22,6 +22,7 @@ import ch.memobase.rdf.DC
import
ch.memobase.rdf.MB
import
ch.memobase.rdf.NS
import
ch.memobase.rdf.RDA
import
ch.memobase.rdf.RDF
import
ch.memobase.rdf.RICO
import
ch.memobase.rdf.RICO.Types.RecordSet
import
com.beust.klaxon.JsonArray
...
...
@@ -53,12 +54,22 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
var
relatedRecordSets
=
LanguageContainer
.
EMPTY
var
publicationTitles
=
LanguageContainer
.
EMPTY
var
relatedDocumentTitles
=
LanguageContainer
.
EMPTY
val
originalCallNumbers
=
mutableListOf
<
String
>()
val
originalIdNumbers
=
mutableListOf
<
String
>()
val
accessInstitutions
=
mutableListOf
<
FacetContainer
>()
val
masterInstitutions
=
mutableListOf
<
FacetContainer
>()
val
originalInstitutions
=
mutableListOf
<
FacetContainer
>()
input
.
values
.
forEach
{
when
{
it
[
RICO
.
type
.
localName
]
==
KEYS
.
LanguageType
.
metadata
->
{
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
[
RICO
.
type
.
localName
]
==
KEYS
.
TitleTypes
.
original
->
{
originalTitles
=
originalTitles
.
add
(
it
[
RICO
.
title
.
localName
])
...
...
@@ -84,6 +95,20 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
val
names
=
elasticSearchWrapper
.
getInstitutionName
(
id
)
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.
...
...
@@ -185,7 +210,11 @@ class RecordSetSearchDocBuilder(private val elasticSearchWrapper: ElasticSearchW
relatedDocuments
=
relatedDocumentTitles
,
dataImport
=
dataImport
,
accessInstitution
=
accessInstitutions
,
teaserTest
=
teaserText
originalInstitution
=
originalInstitutions
,
masterInstitution
=
masterInstitutions
,
teaserTest
=
teaserText
,
originalIdNUmber
=
originalIdNumbers
,
originalCallNumber
=
originalCallNumbers
)
}
...
...
src/main/kotlin/model/RecordSetSearchDoc.kt
View file @
f51b9747
...
...
@@ -58,8 +58,12 @@ data class RecordSetSearchDoc(
val
relatedPublications
:
LanguageContainer
?,
val
relatedDocuments
:
LanguageContainer
?,
val
dataImport
:
LanguageContainer
?,
val
originalCallNumber
:
List
<
String
>,
val
originalIdNUmber
:
List
<
String
>,
// Support Field (required to be indexed in the record).
val
originalInstitution
:
List
<
FacetContainer
>,
val
masterInstitution
:
List
<
FacetContainer
>,
val
accessInstitution
:
List
<
FacetContainer
>
)
:
Schema
(
recordSetId
)
{
...
...
@@ -107,9 +111,11 @@ data class RecordSetSearchDoc(
relatedDocuments
=
LanguageContainer
.
placeholder
(
placeholderTitle
),
dataImport
=
LanguageContainer
.
placeholder
(
lorem
),
accessInstitution
=
emptyList
(),
teaserTest
=
LanguageContainer
.
placeholder
(
lorem
)
teaserTest
=
LanguageContainer
.
placeholder
(
lorem
),
masterInstitution
=
emptyList
(),
originalCallNumber
=
emptyList
(),
originalInstitution
=
emptyList
(),
originalIdNUmber
=
emptyList
()
)
}
}
\ No newline at end of file
src/test/resources/data/recordSets/completeExampleOutput.json
View file @
f51b9747
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment