diff --git a/worker/task.go b/worker/task.go index 12aa32147a6..71666a0e5e0 100644 --- a/worker/task.go +++ b/worker/task.go @@ -1496,14 +1496,10 @@ func applyFacetsTree(postingFacets []*api.Facet, ftree *facetsTree) (bool, error return false, err } - v, has := ftree.function.convertedVal[typId] - if !has { - if v, err = types.Convert(ftree.function.val, typId); err != nil { - // ignore facet if not of appropriate type - return false, nil - } else { - ftree.function.convertedVal[typId] = v - } + v, err := types.Convert(ftree.function.val, typId) + if err != nil { + // ignore facet if not of appropriate type + return false, nil } fVal, err := facets.ValFor(fc) if err != nil { @@ -1590,8 +1586,6 @@ type facetsFunc struct { args []string tokens []string val types.Val - // convertedVal is used to cache the converted value of val for each type - convertedVal map[types.TypeID]types.Val } type facetsTree struct { op string @@ -1607,7 +1601,6 @@ func preprocessFilter(tree *pb.FilterTree) (*facetsTree, error) { ftree.op = tree.Op if tree.Func != nil { ftree.function = &facetsFunc{} - ftree.function.convertedVal = make(map[types.TypeID]types.Val) ftree.function.name = tree.Func.Name ftree.function.key = tree.Func.Key ftree.function.args = tree.Func.Args