Skip to content
GitLab
Menu
Projects
Groups
Snippets
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
3065d8e5
Commit
3065d8e5
authored
Apr 16, 2021
by
Jonas Waeber
Browse files
Replace constant strings with constant vals
parent
d7c7682c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/DocumentsSearchDocBuilder.kt
View file @
3065d8e5
...
...
@@ -37,6 +37,7 @@ import org.memobase.helpers.Filter
import
org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractInstitution
import
org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractRecordSet
import
org.memobase.helpers.Constants
import
org.memobase.helpers.JsonUtility
import
org.memobase.helpers.TranslationMappers
import
org.memobase.model.DocumentsSearchDoc
import
org.memobase.model.EnrichedDigitalMetadata
...
...
@@ -53,7 +54,7 @@ class DocumentsSearchDocBuilder(
fun
transform
(
key
:
String
,
input
:
Map
<
String
,
JsonObject
>):
Schema
{
val
record
=
input
[
"
record
"
]
?:
throw
InvalidInputException
(
"No record defined in the message."
)
val
record
=
input
[
JsonUtility
.
record
Tag
]
?:
throw
InvalidInputException
(
"No record defined in the message."
)
val
digitalObject
=
input
.
values
.
firstOrNull
{
it
[
"@type"
]
==
NS
.
rico
+
"Instantiation"
&&
it
[
"type"
]
==
"digitalObject"
}
val
physicalObject
=
...
...
src/main/kotlin/InstitutionSearchDocBuilder.kt
View file @
3065d8e5
...
...
@@ -27,6 +27,7 @@ import org.memobase.helpers.Date
import
org.memobase.helpers.ElasticSearchWrapper
import
org.memobase.helpers.Extract
import
org.memobase.helpers.Constants
import
org.memobase.helpers.JsonUtility
import
org.memobase.helpers.TranslationMappers
import
org.memobase.model.FacetContainer
import
org.memobase.model.InstitutionSearchDoc
...
...
@@ -42,7 +43,7 @@ class InstitutionSearchDocBuilder(
fun
transform
(
key
:
String
,
input
:
Map
<
String
,
JsonObject
>):
Schema
{
val
institution
=
input
[
"
institution
"
]
?:
throw
InvalidInputException
(
"No institution entity found in message $key."
)
input
[
JsonUtility
.
institution
Tag
]
?:
throw
InvalidInputException
(
"No institution entity found in message $key."
)
val
identifiers
=
mutableListOf
<
JsonObject
>()
val
cantons
=
mutableListOf
<
FacetContainer
>()
val
municipalities
=
mutableListOf
<
LanguageContainer
>()
...
...
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