Skip to content

Commit 9bd81f7

Browse files
authored
ref(search): Remove spaces from wildcard operators (#99399)
Quickly removing the spaces from the wildcard operators to deal spacing issues when splitting a query into tokens. Ticket: EXP-516, EXP-515
1 parent d1f112d commit 9bd81f7

File tree

8 files changed

+100
-100
lines changed

8 files changed

+100
-100
lines changed

fixtures/search-syntax/contains_operator.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[
22
{
3-
"query": "browser.name:containsfirefox",
3+
"query": "browser.name:Containsfirefox",
44
"result": [
55
{"type": "spaces", "value": ""},
66
{
77
"type": "filter",
88
"filter": "text",
99
"negated": false,
10-
"operator": "contains",
10+
"operator": "Contains",
1111
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
1212
"value": {"type": "valueText", "value": "firefox", "quoted": false}
1313
},
1414
{"type": "spaces", "value": ""}
1515
]
1616
},
1717
{
18-
"query": "browser.name:contains[firefox, chrome]",
18+
"query": "browser.name:Contains[firefox, chrome]",
1919
"result": [
2020
{"type": "spaces", "value": ""},
2121
{
2222
"type": "filter",
2323
"filter": "textIn",
2424
"negated": false,
25-
"operator": "contains",
25+
"operator": "Contains",
2626
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
2727
"value": {
2828
"type": "valueTextList",
@@ -42,29 +42,29 @@
4242
]
4343
},
4444
{
45-
"query": "!browser.name:containsfirefox",
45+
"query": "!browser.name:Containsfirefox",
4646
"result": [
4747
{"type": "spaces", "value": ""},
4848
{
4949
"type": "filter",
5050
"filter": "text",
5151
"negated": true,
52-
"operator": "contains",
52+
"operator": "Contains",
5353
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
5454
"value": {"type": "valueText", "value": "firefox", "quoted": false}
5555
},
5656
{"type": "spaces", "value": ""}
5757
]
5858
},
5959
{
60-
"query": "!browser.name:contains[firefox, chrome]",
60+
"query": "!browser.name:Contains[firefox, chrome]",
6161
"result": [
6262
{"type": "spaces", "value": ""},
6363
{
6464
"type": "filter",
6565
"filter": "textIn",
6666
"negated": true,
67-
"operator": "contains",
67+
"operator": "Contains",
6868
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
6969
"value": {
7070
"type": "valueTextList",

fixtures/search-syntax/ends_with_operator.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[
22
{
3-
"query": "browser.name:ends withfirefox",
3+
"query": "browser.name:EndsWithfirefox",
44
"result": [
55
{"type": "spaces", "value": ""},
66
{
77
"type": "filter",
88
"filter": "text",
99
"negated": false,
10-
"operator": "ends with",
10+
"operator": "EndsWith",
1111
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
1212
"value": {"type": "valueText", "value": "firefox", "quoted": false}
1313
},
1414
{"type": "spaces", "value": ""}
1515
]
1616
},
1717
{
18-
"query": "browser.name:ends with[firefox, chrome]",
18+
"query": "browser.name:EndsWith[firefox, chrome]",
1919
"result": [
2020
{"type": "spaces", "value": ""},
2121
{
2222
"type": "filter",
2323
"filter": "textIn",
2424
"negated": false,
25-
"operator": "ends with",
25+
"operator": "EndsWith",
2626
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
2727
"value": {
2828
"type": "valueTextList",
@@ -42,29 +42,29 @@
4242
]
4343
},
4444
{
45-
"query": "!browser.name:ends withfirefox",
45+
"query": "!browser.name:EndsWithfirefox",
4646
"result": [
4747
{"type": "spaces", "value": ""},
4848
{
4949
"type": "filter",
5050
"filter": "text",
5151
"negated": true,
52-
"operator": "ends with",
52+
"operator": "EndsWith",
5353
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
5454
"value": {"type": "valueText", "value": "firefox", "quoted": false}
5555
},
5656
{"type": "spaces", "value": ""}
5757
]
5858
},
5959
{
60-
"query": "!browser.name:ends with[firefox, chrome]",
60+
"query": "!browser.name:EndsWith[firefox, chrome]",
6161
"result": [
6262
{"type": "spaces", "value": ""},
6363
{
6464
"type": "filter",
6565
"filter": "textIn",
6666
"negated": true,
67-
"operator": "ends with",
67+
"operator": "EndsWith",
6868
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
6969
"value": {
7070
"type": "valueTextList",

fixtures/search-syntax/starts_with_operator.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[
22
{
3-
"query": "browser.name:starts withfirefox",
3+
"query": "browser.name:StartsWithfirefox",
44
"result": [
55
{"type": "spaces", "value": ""},
66
{
77
"type": "filter",
88
"filter": "text",
99
"negated": false,
10-
"operator": "starts with",
10+
"operator": "StartsWith",
1111
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
1212
"value": {"type": "valueText", "value": "firefox", "quoted": false}
1313
},
1414
{"type": "spaces", "value": ""}
1515
]
1616
},
1717
{
18-
"query": "browser.name:starts with[firefox, chrome]",
18+
"query": "browser.name:StartsWith[firefox, chrome]",
1919
"result": [
2020
{"type": "spaces", "value": ""},
2121
{
2222
"type": "filter",
2323
"filter": "textIn",
2424
"negated": false,
25-
"operator": "starts with",
25+
"operator": "StartsWith",
2626
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
2727
"value": {
2828
"type": "valueTextList",
@@ -42,29 +42,29 @@
4242
]
4343
},
4444
{
45-
"query": "!browser.name:starts withfirefox",
45+
"query": "!browser.name:StartsWithfirefox",
4646
"result": [
4747
{"type": "spaces", "value": ""},
4848
{
4949
"type": "filter",
5050
"filter": "text",
5151
"negated": true,
52-
"operator": "starts with",
52+
"operator": "StartsWith",
5353
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
5454
"value": {"type": "valueText", "value": "firefox", "quoted": false}
5555
},
5656
{"type": "spaces", "value": ""}
5757
]
5858
},
5959
{
60-
"query": "!browser.name:starts with[firefox, chrome]",
60+
"query": "!browser.name:StartsWith[firefox, chrome]",
6161
"result": [
6262
{"type": "spaces", "value": ""},
6363
{
6464
"type": "filter",
6565
"filter": "textIn",
6666
"negated": true,
67-
"operator": "starts with",
67+
"operator": "StartsWith",
6868
"key": {"type": "keySimple", "value": "browser.name", "quoted": false},
6969
"value": {
7070
"type": "valueTextList",

src/sentry/api/event_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@
206206
negation = "!"
207207
# Note: wildcard unicode is defined in src/sentry/search/events/constants.py
208208
wildcard_unicode = "\uF00D"
209-
contains = "contains"
210-
starts_with = "starts with"
211-
ends_with = "ends with"
209+
contains = "Contains"
210+
starts_with = "StartsWith"
211+
ends_with = "EndsWith"
212212
comma = ","
213213
spaces = " "*
214214

src/sentry/search/events/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ class ThresholdDict(TypedDict):
310310
WILDCARD_UNICODE = "\uf00d"
311311

312312
WILDCARD_OPERATOR_MAP = {
313-
"contains": f"{WILDCARD_UNICODE}contains{WILDCARD_UNICODE}",
314-
"starts_with": f"{WILDCARD_UNICODE}starts with{WILDCARD_UNICODE}",
315-
"ends_with": f"{WILDCARD_UNICODE}ends with{WILDCARD_UNICODE}",
313+
"contains": f"{WILDCARD_UNICODE}Contains{WILDCARD_UNICODE}",
314+
"starts_with": f"{WILDCARD_UNICODE}StartsWith{WILDCARD_UNICODE}",
315+
"ends_with": f"{WILDCARD_UNICODE}EndsWith{WILDCARD_UNICODE}",
316316
}
317317

318318
MAX_SEARCH_RELEASES = 1000

static/app/components/searchSyntax/grammar.pegjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,9 @@ closed_bracket = "]"
450450
sep = ":"
451451
negation = "!"
452452
wildcard_unicode = [\uF00D]
453-
contains = "contains"
454-
starts_with = "starts with"
455-
ends_with = "ends with"
453+
contains = "Contains"
454+
starts_with = "StartsWith"
455+
ends_with = "EndsWith"
456456
comma = ","
457457
spaces = " "* { return tc.tokenSpaces(text()) }
458458

static/app/components/searchSyntax/parser.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ export enum TermOperator {
7676
LESS_THAN = '<',
7777
EQUAL = '=',
7878
NOT_EQUAL = '!=',
79-
CONTAINS = '\uf00dcontains\uf00d',
80-
DOES_NOT_CONTAIN = '\uf00ddoes not contain\uf00d',
81-
STARTS_WITH = '\uf00dstarts with\uf00d',
82-
DOES_NOT_START_WITH = '\uf00ddoes not start with\uf00d',
83-
ENDS_WITH = '\uf00dends with\uf00d',
84-
DOES_NOT_END_WITH = '\uf00ddoes not end with\uf00d',
79+
CONTAINS = '\uf00dContains\uf00d',
80+
DOES_NOT_CONTAIN = '\uf00dDoesNotContain\uf00d',
81+
STARTS_WITH = '\uf00dStartsWith\uf00d',
82+
DOES_NOT_START_WITH = '\uf00dDoesNotStartWith\uf00d',
83+
ENDS_WITH = '\uf00dEndsWith\uf00d',
84+
DOES_NOT_END_WITH = '\uf00dDoesNotEndWith\uf00d',
8585
}
8686

8787
/**
@@ -125,9 +125,9 @@ export enum FilterType {
125125
* Unicode Character: `\uf00d`
126126
*/
127127
export enum WildcardOperators {
128-
CONTAINS = '\uf00dcontains\uf00d',
129-
STARTS_WITH = '\uf00dstarts with\uf00d',
130-
ENDS_WITH = '\uf00dends with\uf00d',
128+
CONTAINS = '\uf00dContains\uf00d',
129+
STARTS_WITH = '\uf00dStartsWith\uf00d',
130+
ENDS_WITH = '\uf00dEndsWith\uf00d',
131131
}
132132

133133
export const basicOperators = [TermOperator.DEFAULT, TermOperator.NOT_EQUAL] as const;

0 commit comments

Comments
 (0)