feat(explore): add multi-key support for has: search filter#109907
Merged
manessaraj merged 4 commits intomasterfrom Mar 9, 2026
Merged
Conversation
65dabca to
d0fa8a6
Compare
Extends the `has:` search filter to accept a comma-separated list of attribute keys, allowing users to assert the presence of multiple span attributes in a single token. Previously, checking for multiple keys required chaining with OR: has:query.period OR has:query.error_reason With this change, users can write: has:[query.period,query.error_reason] Fixes BROWSE-406
92c1b9d to
c37567a
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Nested comprehension incorrectly unwraps SearchKey NamedTuples to strings
- Corrected return type annotations from list[list[SearchKey]] to list[SearchKey] and removed the incorrect double-nested comprehension that was unwrapping SearchKey objects into strings.
Or push these changes by commenting:
@cursor push 696a15f77b
Preview (696a15f77b)
diff --git a/src/sentry/api/event_search.py b/src/sentry/api/event_search.py
--- a/src/sentry/api/event_search.py
+++ b/src/sentry/api/event_search.py
@@ -1813,7 +1813,7 @@
str, # ']'
Node, # terminating lookahead
],
- ) -> list[list[SearchKey]]:
+ ) -> list[SearchKey]:
return process_list(children[1], children[2])
def visit_has_in_filter(
@@ -1824,11 +1824,11 @@
Node, # has: lookahead
SearchKey, # SearchKey('has')
Node, # :
- list[list[SearchKey]],
+ list[SearchKey],
],
) -> ParenExpression:
(negation, _, _, _, search_key_lst) = children
- search_keys: list[SearchKey] = [sk for sublist in search_key_lst for sk in sublist]
+ search_keys: list[SearchKey] = search_key_lst
# if it matched search value instead, it's not a valid key
if any(isinstance(search_key, SearchValue) for search_key in search_keys):
wmak
reviewed
Mar 6, 2026
…t-for-has-search-filter-eg
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Extends the
has:search filter to accept a comma-separated list of attribute keys, allowing users to assert the presence of any of the multiple span attributes in a single token.Previously, checking for multiple keys required chaining with OR:
has:query.period OR has:query.error_reason
With this change, users can write:
has:[query.period,query.error_reason]
Fixes BROWSE-406