diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-28 16:53:35 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-28 16:53:35 -0400 |
| commit | 83e2cd972d12979232eb8c1043ad3d649d03880d (patch) | |
| tree | 2aaf1e63daefcbea7afc3ba623bab80f81b915c0 /pkg | |
| parent | 3b8dcd30f5aca7624a22cff85a2f767d8d1fb583 (diff) | |
Fix incorrect compiling of regex queries on set categories
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/query/compiler.go | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/pkg/query/compiler.go b/pkg/query/compiler.go index 7000544..0637fea 100644 --- a/pkg/query/compiler.go +++ b/pkg/query/compiler.go @@ -107,7 +107,31 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error } } - if cat.IsSet() && op != OP_AP { + if op == OP_RE { + idx := 0 + for _, stmt := range opStmts { + b.WriteString("( ") + b.WriteString(catStr) + b.WriteString("IS NOT NULL AND ") + if stmt.Negated { + b.WriteString("NOT ") + } + b.WriteString(catStr) + b.WriteString(opStr) + arg, ok := stmt.Value.buildCompile(b) + b.WriteString(" )") + if ok { + args = append(args, arg) + } + b.WriteByte(' ') + if idx != len(opStmts)-1 { + b.WriteString(delim) + b.WriteByte(' ') + } + idx++ + sCount++ + } + } else if cat.IsSet() && op != OP_AP { b.WriteString(catStr) b.WriteString(opStr) b.WriteByte('(') @@ -166,30 +190,6 @@ func (s Statements) buildCompile(b *strings.Builder, delim string) ([]any, error idx++ sCount++ } - } else if op == OP_RE { - idx := 0 - for _, stmt := range opStmts { - b.WriteString("( ") - b.WriteString(catStr) - b.WriteString("IS NOT NULL AND ") - if stmt.Negated { - b.WriteString("NOT ") - } - b.WriteString(catStr) - b.WriteString(opStr) - arg, ok := stmt.Value.buildCompile(b) - b.WriteString(" )") - if ok { - args = append(args, arg) - } - b.WriteByte(' ') - if idx != len(opStmts)-1 { - b.WriteString(delim) - b.WriteByte(' ') - } - idx++ - sCount++ - } } else { idx := 0 for _, stmt := range opStmts { |
