mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 15:29:24 +01:00
lib/logstorage: allow using -
instead of !
in front of (...)
This commit is contained in:
parent
fce6fc745a
commit
b7a3d575da
@ -840,7 +840,7 @@ func parseGenericFilter(lex *lexer, fieldName string) (filter, error) {
|
|||||||
}
|
}
|
||||||
return f, nil
|
return f, nil
|
||||||
case lex.isKeyword("("):
|
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 nil, fmt.Errorf("missing whitespace before the search word %q", lex.prevToken)
|
||||||
}
|
}
|
||||||
return parseParensFilter(lex, fieldName)
|
return parseParensFilter(lex, fieldName)
|
||||||
|
@ -646,6 +646,8 @@ func TestParseQuerySuccess(t *testing.T) {
|
|||||||
f(`not(foo)`, `!foo`)
|
f(`not(foo)`, `!foo`)
|
||||||
f(`not (foo)`, `!foo`)
|
f(`not (foo)`, `!foo`)
|
||||||
f(`not ( foo or bar )`, `!(foo or bar)`)
|
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(`foo:!""`, `!foo:""`)
|
||||||
f("_msg:foo", "foo")
|
f("_msg:foo", "foo")
|
||||||
f("'foo:bar'", `"foo:bar"`)
|
f("'foo:bar'", `"foo:bar"`)
|
||||||
|
Loading…
Reference in New Issue
Block a user