From 786b25020b986fa3420b4579ed5d94743949d8d0 Mon Sep 17 00:00:00 2001 From: momo-p Date: Thu, 31 Oct 2024 02:36:24 +0700 Subject: [PATCH] feat(chie): append normalized normalized additional name to title tag index --- services/chie/titles.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/services/chie/titles.go b/services/chie/titles.go index e954c71..41d028b 100644 --- a/services/chie/titles.go +++ b/services/chie/titles.go @@ -329,6 +329,7 @@ func updateTitleIndexTags(index *titleIndex) error { normalizeTitleName(index.Name), } index.Tags = append(index.Tags, index.AdditionalName...) + index.Tags = append(index.Tags, normalizeAdditionalName(index.AdditionalName)...) return nil } @@ -339,3 +340,18 @@ func normalizeTitleName(name string) string { " ", ) } + +func normalizeAdditionalName(additionalName []string) []string { + normalizedAdditionalName := []string{} + for _, name := range additionalName { + normalizedAdditionalName = append( + normalizedAdditionalName, + strings.ReplaceAll( + slug.Make(name), + "-", + " ", + ), + ) + } + return normalizedAdditionalName +}