diff --git a/api/src/main/kotlin/edu/wgu/osmt/api/model/ApiSortEnum.kt b/api/src/main/kotlin/edu/wgu/osmt/api/model/ApiSortEnum.kt index 0a386ac10..06d360087 100644 --- a/api/src/main/kotlin/edu/wgu/osmt/api/model/ApiSortEnum.kt +++ b/api/src/main/kotlin/edu/wgu/osmt/api/model/ApiSortEnum.kt @@ -37,10 +37,14 @@ interface SortOrderCompanion where T: SortOrder{ */ enum class SkillSortEnum(override val apiValue: String) : SortOrder { CategoryAsc("name.asc") { - override val sort = Sort.by("category.keyword").ascending() + override val sort = Sort.by( + Sort.Order.asc("category.sort_insensitive"), + Sort.Order.asc("name.sort_insensitive")) }, CategoryDesc("name.desc") { - override val sort = Sort.by("category.keyword").descending() + override val sort = Sort.by( + Sort.Order.desc("category.sort_insensitive"), + Sort.Order.asc("name.sort_insensitive")) }, NameAsc("skill.asc") { override val sort = Sort.by(nameKeyword).ascending() diff --git a/api/src/main/kotlin/edu/wgu/osmt/richskill/RichSkillDoc.kt b/api/src/main/kotlin/edu/wgu/osmt/richskill/RichSkillDoc.kt index 670119264..6fa2ce2ca 100644 --- a/api/src/main/kotlin/edu/wgu/osmt/richskill/RichSkillDoc.kt +++ b/api/src/main/kotlin/edu/wgu/osmt/richskill/RichSkillDoc.kt @@ -44,7 +44,8 @@ data class RichSkillDoc( otherFields = [ InnerField(suffix = "", type = Search_As_You_Type), InnerField(suffix = "raw", analyzer = "whitespace_exact", type = Text), - InnerField(suffix = "keyword", type = Keyword) + InnerField(suffix = "keyword", type = Keyword), + InnerField(suffix = "sort_insensitive", type = Keyword, normalizer = "lowercase_normalizer") ] ) @get:JsonProperty("skillName") @@ -67,7 +68,8 @@ data class RichSkillDoc( otherFields = [ InnerField(suffix = "", type = Search_As_You_Type), InnerField(suffix = "raw", analyzer = "whitespace_exact", type = Text), - InnerField(suffix = "keyword", type = Keyword) + InnerField(suffix = "keyword", type = Keyword), + InnerField(suffix = "sort_insensitive", type = Keyword, normalizer = "lowercase_normalizer") ] ) @get:JsonProperty diff --git a/api/src/main/resources/elasticsearch/settings.json b/api/src/main/resources/elasticsearch/settings.json index 56c8235b1..76939bee5 100644 --- a/api/src/main/resources/elasticsearch/settings.json +++ b/api/src/main/resources/elasticsearch/settings.json @@ -13,6 +13,13 @@ "lowercase" ] } + }, + "normalizer": { + "lowercase_normalizer": { + "type": "custom", + "char_filter": [], + "filter": ["lowercase"] + } } } }