diff --git a/engine/filters.go b/engine/filters.go index 4036ffa3b..416a96a0a 100644 --- a/engine/filters.go +++ b/engine/filters.go @@ -166,32 +166,33 @@ func splitDynFltrValues(val, sep string) (vals []string) { return append(vals, valsEnd[1:]...) } -func splitInlineFilter(rule string) (splt []string) { - var p, st int - splt = make([]string, 0, 3) - for i, b := range rule { - switch byte(b) { - case utils.InInFieldSep[0]: - if p == 0 { - splt = append(splt, rule[st:i]) - st = i + 1 - if len(splt) == 2 { - splt = append(splt, rule[st:]) - return - } - } - case utils.IdxStart[0]: - p++ - case utils.IdxEnd[0]: - p-- - } - } - return -} +// func splitInlineFilter(rule string) (splt []string) { +// var p, st int +// splt = make([]string, 0, 3) +// for i, b := range rule { +// switch byte(b) { +// case utils.InInFieldSep[0]: +// if p == 0 { +// splt = append(splt, rule[st:i]) +// st = i + 1 +// if len(splt) == 2 { +// splt = append(splt, rule[st:]) +// return +// } +// } +// case utils.IdxStart[0]: +// p++ +// case utils.IdxEnd[0]: +// p-- +// } +// } +// return +// } // NewFilterFromInline parses an inline rule into a compiled Filter func NewFilterFromInline(tenant, inlnRule string) (f *Filter, err error) { - ruleSplt := splitInlineFilter(inlnRule) + // ruleSplt := splitInlineFilter(inlnRule) + ruleSplt := strings.SplitN(inlnRule, utils.InInFieldSep, 3) if len(ruleSplt) != 3 { return nil, fmt.Errorf("inline parse error for string: <%s>", inlnRule) }