Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 00ea411

Browse files
committed
Fix keyword field comparison
1 parent 0d95624 commit 00ea411

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

platform/frontend_connectors/schema_transformer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,9 @@ func (s *SchemaCheckPass) applyMatchOperator(indexSchema schema.Schema, query *m
12071207
rhs.Value = strings.Trim(rhsValue, "%")
12081208
rhs.Attrs[model.EscapeKey] = model.NormalNotEscaped
12091209
return equal()
1210-
case schema.QuesmaTypeKeyword.Name:
1210+
case schema.QuesmaTypeKeyword.Name: // similar as above, but for keyword type, un-ilike it
1211+
rhs.Value = strings.Trim(rhsValue, "%")
1212+
rhs.Attrs[model.EscapeKey] = model.FullyEscaped
12111213
return equal()
12121214
default:
12131215
if rhsValue == "%%" { // ILIKE '%%' has terrible performance, but semantically means "is not null", hence this transformation

platform/testdata/requests.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ var TestsSearch = []SearchTestCase{
11331133
}`,
11341134
[]string{`"host_name" __quesma_match '%prometheus%'`},
11351135
model.ListAllFields,
1136-
[]string{`SELECT "message" FROM ` + TableName + ` WHERE "host_name"='%prometheus%' LIMIT 10`},
1136+
[]string{`SELECT "message" FROM ` + TableName + ` WHERE "host_name"='prometheus' LIMIT 10`},
11371137
[]string{},
11381138
},
11391139
{ // [6]
@@ -1712,7 +1712,7 @@ var TestsSearch = []SearchTestCase{
17121712
"stream_namespace" AS "aggr__suggestions__key_0",
17131713
count(*) AS "aggr__suggestions__count"
17141714
FROM __quesma_table_name
1715-
WHERE (("message" ILIKE '%User logged out%' AND "host_name"='%poseidon%')
1715+
WHERE (("message" ILIKE '%User logged out%' AND "host_name"='poseidon')
17161716
AND ("@timestamp">=fromUnixTimestamp64Milli(1706542596491) AND "@timestamp"<=fromUnixTimestamp64Milli(1706551896491)))
17171717
GROUP BY "stream_namespace" AS "aggr__suggestions__key_0"
17181718
ORDER BY "aggr__suggestions__count" DESC, "aggr__suggestions__key_0" ASC
@@ -1870,7 +1870,7 @@ var TestsSearch = []SearchTestCase{
18701870
"namespace" AS "aggr__suggestions__key_0",
18711871
count(*) AS "aggr__suggestions__count"
18721872
FROM __quesma_table_name
1873-
WHERE (("message" ILIKE '%User logged out%' AND "host_name"='%poseidon%')
1873+
WHERE (("message" ILIKE '%User logged out%' AND "host_name"='poseidon')
18741874
AND ("@timestamp">=fromUnixTimestamp64Milli(1706542596491) AND "@timestamp"<=fromUnixTimestamp64Milli(1706551896491)))
18751875
GROUP BY "namespace" AS "aggr__suggestions__key_0"
18761876
ORDER BY "aggr__suggestions__count" DESC, "aggr__suggestions__key_0" ASC

0 commit comments

Comments
 (0)