Skip to content

Commit

Permalink
fix: case sensitive selected field search fixed (SigNoz#2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
nityanandagohain committed Mar 31, 2023
1 parent 36610c8 commit 31a89bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/query-service/app/logs/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ func parseLogQuery(query string) ([]string, error) {
searchString := strings.TrimSpace(strings.Split(v, op)[1])

operatorRemovedTokens := strings.Split(operatorRegex.ReplaceAllString(v, " "), " ")
searchCol := strings.ToLower(operatorRemovedTokens[0])
if searchCol == AND || searchCol == OR {
searchCol = strings.ToLower(operatorRemovedTokens[1])
searchCol := operatorRemovedTokens[0]
if strings.ToLower(searchCol) == AND || strings.ToLower(searchCol) == OR {
searchCol = operatorRemovedTokens[1]
}
col := searchCol
if strings.ToLower(searchCol) == "fulltext" {
Expand Down
5 changes: 5 additions & 0 deletions pkg/query-service/app/logs/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ var correctQueriesTest = []struct {
`id.userid in (100) and id_userid gt 50`,
[]string{`id.userid IN (100) `, `and id_userid > 50 `},
},
{
`filters with case sensitive key name`,
`userIdentifier in ('user') and userIdentifier contains 'user'`,
[]string{`userIdentifier IN ('user') `, `AND userIdentifier ILIKE '%user%' `},
},
}

func TestParseLogQueryCorrect(t *testing.T) {
Expand Down

0 comments on commit 31a89bf

Please sign in to comment.