mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 20:29:04 +08:00
parser updated to support more than one contains
This commit is contained in:
parent
0fe4327877
commit
294d527a0e
@ -31,7 +31,7 @@ const (
|
||||
IDEND = "idEnd"
|
||||
)
|
||||
|
||||
var tokenRegex, _ = regexp.Compile(`(?i)(and( )*?)?(([\w.-]+ (in|nin) \([\S ]+\))|([\w.]+ (gt|lt|gte|lte) (')?[\S]+(')?)|([\w.]+ (contains|ncontains)) (')?[\S ]+(')?)`)
|
||||
var tokenRegex, _ = regexp.Compile(`(?i)(and( )*?)?(([\w.-]+ (in|nin) \([\S ]+\))|([\w.]+ (gt|lt|gte|lte) (')?[\S]+(')?)|([\w.]+ (contains|ncontains)) (')?[^']+(')?)`)
|
||||
var operatorRegex, _ = regexp.Compile(`(?i)(?: )(in|nin|gt|lt|gte|lte|contains|ncontains)(?: )`)
|
||||
|
||||
func ParseLogFilterParams(r *http.Request) (*model.LogsFilterParams, error) {
|
||||
|
@ -32,6 +32,11 @@ var correctQueriesTest = []struct {
|
||||
`resource contains 'Hello, "World"'`,
|
||||
[]string{`resource ILIKE '%Hello, "World"%' `},
|
||||
},
|
||||
{
|
||||
`more than one continas`,
|
||||
`resource contains 'Hello, "World"' and myresource contains 'abcd'`,
|
||||
[]string{`resource ILIKE '%Hello, "World"%' `, `AND myresource ILIKE '%abcd%' `},
|
||||
},
|
||||
{
|
||||
`filters with lt,gt,lte,gte operators`,
|
||||
`id lt 100 and id gt 50 and code lte 500 and code gte 400`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user