Skip to content

Commit

Permalink
fix: empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Oct 14, 2024
1 parent 92020e6 commit 053ee00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class ConceptSearchService(

private var anbefaltTermSortScript: String =
"""
if (!doc['anbefaltTerm.navn.nb.keyword'].empty) {
if (doc.containsKey('anbefaltTerm.navn.nb.keyword') && doc['anbefaltTerm.navn.nb.keyword'].value.length() > 0) {
return doc['anbefaltTerm.navn.nb.keyword'].value.toLowerCase();
} else if (!doc['anbefaltTerm.navn.nn.keyword'].empty) {
} else if (doc.containsKey('anbefaltTerm.navn.nn.keyword') && doc['anbefaltTerm.navn.nn.keyword'].value.length() > 0) {
return doc['anbefaltTerm.navn.nn.keyword'].value.toLowerCase();
} else if (!doc['anbefaltTerm.navn.en.keyword'].empty) {
} else if (doc.containsKey('anbefaltTerm.navn.en.keyword') && doc['anbefaltTerm.navn.en.keyword'].value.length() > 0) {
return doc['anbefaltTerm.navn.en.keyword'].value.toLowerCase();
} else {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/no/fdk/concept_catalog/utils/TestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ val BEGREP_3 = Begrep(
erPublisert = true,
publiseringsTidspunkt = ZonedDateTime.of(2020, 1, 2, 12,0,0,0, ZoneId.of("Europe/Oslo")).toInstant(),
gjeldendeRevisjon = null,
anbefaltTerm = Term(navn = mapOf(Pair("nn", "Begrep 3"))),
anbefaltTerm = Term(navn = mapOf(Pair("nb", ""), Pair("nn", "Begrep 3"))),
definisjon = Definisjon(
tekst = mapOf(Pair("nb", "definisjon")),
kildebeskrivelse = Kildebeskrivelse(
Expand Down

0 comments on commit 053ee00

Please sign in to comment.