@@ -32,6 +32,7 @@ import (
32
32
33
33
enumspb "go.temporal.io/api/enums/v1"
34
34
"go.temporal.io/api/serviceerror"
35
+ "golang.org/x/exp/maps"
35
36
36
37
persistencespb "go.temporal.io/server/api/persistence/v1"
37
38
"go.temporal.io/server/common/clock"
@@ -110,20 +111,24 @@ func (m *managerImpl) GetSearchAttributes(
110
111
m .cacheUpdateMutex .Unlock ()
111
112
}
112
113
114
+ result := NameTypeMap {}
113
115
indexSearchAttributes , ok := saCache .searchAttributes [indexName ]
114
116
if ok {
115
- return indexSearchAttributes , nil
117
+ result . customSearchAttributes = maps . Clone ( indexSearchAttributes . customSearchAttributes )
116
118
}
117
119
120
+ // TODO (rodrigozhou): remove following block for v1.21.
121
+ // Try to look for the empty string indexName for backward compatibility: up to v1.19,
122
+ // empty string was used when Elasticsearch was not configured.
123
+ // If there's a value, merging with current index name value. This is to avoid handling
124
+ // all code references to GetSearchAttributes.
118
125
if indexName != "" {
119
- // Try to look for the empty string indexName for backward compatibility: up to v1.19,
120
- // empty string was used when Elasticsearch was not configured.
121
126
indexSearchAttributes , ok = saCache .searchAttributes ["" ]
122
127
if ok {
123
- return indexSearchAttributes , nil
128
+ maps . Copy ( result . customSearchAttributes , indexSearchAttributes . customSearchAttributes )
124
129
}
125
130
}
126
- return NameTypeMap {} , nil
131
+ return result , nil
127
132
}
128
133
129
134
func (m * managerImpl ) needRefreshCache (saCache cache , forceRefreshCache bool , now time.Time ) bool {
0 commit comments