Skip to content

Commit

Permalink
Fix NOT filters (#8116)
Browse files Browse the repository at this point in the history
## Summary
The `NOT` filter has a child filter with no values, so it was always
returning true and then negated by the `NOT`. As a result, all logs,
traces, etc were being included.

Update the `NOT` logic to return the negated version of the child
filter.


https://www.loom.com/share/d39d84adf6d6402da8a5bd66dcc6c34d?sid=4ee2d652-caff-4838-b044-6153bc6a30af

## How did you test this change?
1) Update the workspace to be enterprise
2) Add a `[key]!=[value]` on one of the filters
- [ ] Confirm the only resources displayed pass the filter.
4) Repeat for `NOT [key]=[value]`
- [ ] Confirm the only resources displayed pass the filter.

## Are there any deployment considerations?
N/A

## Does this work require review from our design team?
N/A
  • Loading branch information
SpennyNDaJets committed Mar 27, 2024
1 parent 89cca41 commit 19e1e60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/clickhouse/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ func matchesQuery[TObj interface{}, TReservedKey ~string](row *TObj, config mode
if !anyMatch {
return false
}
case listener.OperatorNot:
return !matchesQuery(row, config, listener.Filters{filter.Filters[0]})
default:
matches := matchFilter(row, config, filter)
if filter.Operator == listener.OperatorNot && matches {
return false
} else if !matches {
if !matches {
return false
}
}
Expand Down

0 comments on commit 19e1e60

Please sign in to comment.