mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/logstorage: allow using -
instead of !
in front of (...)
This commit is contained in:
parent
fce6fc745a
commit
b7a3d575da
2 changed files with 3 additions and 1 deletions
|
@ -840,7 +840,7 @@ func parseGenericFilter(lex *lexer, fieldName string) (filter, error) {
|
|||
}
|
||||
return f, nil
|
||||
case lex.isKeyword("("):
|
||||
if !lex.isSkippedSpace && !lex.isPrevToken("", ":", "(", "!", "not") {
|
||||
if !lex.isSkippedSpace && !lex.isPrevToken("", ":", "(", "!", "-", "not") {
|
||||
return nil, fmt.Errorf("missing whitespace before the search word %q", lex.prevToken)
|
||||
}
|
||||
return parseParensFilter(lex, fieldName)
|
||||
|
|
|
@ -646,6 +646,8 @@ func TestParseQuerySuccess(t *testing.T) {
|
|||
f(`not(foo)`, `!foo`)
|
||||
f(`not (foo)`, `!foo`)
|
||||
f(`not ( foo or bar )`, `!(foo or bar)`)
|
||||
f(`!(foo or bar)`, `!(foo or bar)`)
|
||||
f(`-(foo or bar)`, `!(foo or bar)`)
|
||||
f(`foo:!""`, `!foo:""`)
|
||||
f("_msg:foo", "foo")
|
||||
f("'foo:bar'", `"foo:bar"`)
|
||||
|
|
Loading…
Reference in a new issue