diff --git a/caching_compiler.go b/caching_compiler.go index 4220721..01ab592 100644 --- a/caching_compiler.go +++ b/caching_compiler.go @@ -8,9 +8,7 @@ import ( "github.com/karlseguin/ccache/v2" ) -var ( - CacheTime = time.Hour -) +var CacheTime = time.Hour // NewCachingCompiler returns a CELCompiler which lifts quoted literals out of the expression // as variables and uses caching to cache expression parsing, resulting in improved @@ -39,6 +37,10 @@ func (c *cachingCompiler) Parse(expr string) (*cel.Ast, *cel.Issues, LiftedArgs) } expr, vars := liftLiterals(expr) + if vars == nil { + // enusre this is never non-nil. + vars = regularArgMap{} + } if cached := c.cache.Get("cc:" + expr); cached != nil { cached.Extend(CacheTime) diff --git a/expr.go b/expr.go index 63f16fa..3619d6d 100644 --- a/expr.go +++ b/expr.go @@ -639,7 +639,6 @@ func engineType(p Predicate) EngineType { if p.Operator == operators.NotEquals || p.Operator == operators.In { return EngineTypeNone } - // return EngineTypeNone return EngineTypeBTree case string: if len(v) == 0 {