@@ -85,10 +85,20 @@ type Clauses []Clause
85
85
func (c Clauses ) Evaluate (target * Target , segments Segments ) bool {
86
86
// AND operation
87
87
for _ , clause := range c {
88
- // operator should be evaluated based on type of attribute
89
- op , err := target .GetOperator (clause .Attribute )
90
- if err != nil {
91
- log .Warn (err )
88
+
89
+ // If this is a SegmentMatch clause, then we don't need to get the operator for the
90
+ // attribute, as it is handled inside the Evaluate code below.
91
+ //
92
+ // If it is any other type of clause (i.e. if its an equals, contains etc)
93
+ // then we need to get the appropriate operator depending on the type of attribute
94
+ var op types.ValueType
95
+ var err error
96
+
97
+ if clause .Op != segmentMatchOperator {
98
+ op , err = target .GetOperator (clause .Attribute )
99
+ if err != nil {
100
+ log .Warn (err )
101
+ }
92
102
}
93
103
if ! clause .Evaluate (target , segments , op ) {
94
104
return false
@@ -239,12 +249,8 @@ func (fc FeatureConfig) GetVariationName(target *Target) string {
239
249
if ! ok {
240
250
log .Error ("The segment in variation map is invalid" )
241
251
} else {
242
- if segment .Included != nil {
243
- for _ , t := range segment .Included {
244
- if t == target .Identifier {
245
- return variationMap .Variation
246
- }
247
- }
252
+ if segment .Evaluate (target ) {
253
+ return variationMap .Variation
248
254
}
249
255
}
250
256
}
0 commit comments