Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
CascadingRadium committed Dec 19, 2024
1 parent ccb4a71 commit 41fc99e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions search/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ type SearcherEndCallbackFn func(size uint64) error
// field -> term -> synonyms
type FieldTermSynonymMap map[string]map[string][]string

func (f *FieldTermSynonymMap) MergeWith(fts FieldTermSynonymMap) {
func (f FieldTermSynonymMap) MergeWith(fts FieldTermSynonymMap) {
for field, termSynonymMap := range fts {
// Ensure the field exists in the receiver
if _, exists := (*f)[field]; !exists {
(*f)[field] = make(map[string][]string)
if _, exists := f[field]; !exists {
f[field] = make(map[string][]string)
}
for term, synonyms := range termSynonymMap {
// Append synonyms
(*f)[field][term] = append((*f)[field][term], synonyms...)
f[field][term] = append(f[field][term], synonyms...)
}
}
}
Expand Down

0 comments on commit 41fc99e

Please sign in to comment.