From 831eab5df068749bbdf2126e1fa17a8c0099954d Mon Sep 17 00:00:00 2001 From: Lorenzo Natali Date: Tue, 3 Dec 2024 11:28:25 +0100 Subject: [PATCH] Fix #10697 parsing of CQL ILIKE filter (#10698) --- web/client/utils/ogc/Filter/CQL/__tests__/parser-test.js | 6 ++++++ web/client/utils/ogc/Filter/CQL/parser.js | 2 +- web/client/utils/ogc/Filter/__tests__/fromObject-test.js | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/web/client/utils/ogc/Filter/CQL/__tests__/parser-test.js b/web/client/utils/ogc/Filter/CQL/__tests__/parser-test.js index 612e43adda..a8117dba78 100644 --- a/web/client/utils/ogc/Filter/CQL/__tests__/parser-test.js +++ b/web/client/utils/ogc/Filter/CQL/__tests__/parser-test.js @@ -60,6 +60,12 @@ const COMPARISON_TESTS = [ args: [{type: "property", name: "PROP"}, {type: "literal", value: 'a'}], type: "like" } + }, { + cql: "PROP ilike 'a'", + expected: { + args: [{type: "property", name: "PROP"}, {type: "literal", value: 'a'}], + type: "ilike" + } }, { cql: "INCLUDE", diff --git a/web/client/utils/ogc/Filter/CQL/parser.js b/web/client/utils/ogc/Filter/CQL/parser.js index e4c9cb405f..b9b7849944 100644 --- a/web/client/utils/ogc/Filter/CQL/parser.js +++ b/web/client/utils/ogc/Filter/CQL/parser.js @@ -19,7 +19,7 @@ export const functionOperator = "func"; export const patterns = { INCLUDE: /^INCLUDE$/, PROPERTY: /^"?[_a-zA-Z"]\w*"?/, - COMPARISON: /^(=|<>|<=|<|>=|>|LIKE)/i, + COMPARISON: /^(=|<>|<=|<|>=|>|LIKE|ILIKE)/i, IS_NULL: /^IS NULL/i, COMMA: /^,/, AND: /^(AND)/i, diff --git a/web/client/utils/ogc/Filter/__tests__/fromObject-test.js b/web/client/utils/ogc/Filter/__tests__/fromObject-test.js index 4a29e3cc82..af7cc7a37e 100644 --- a/web/client/utils/ogc/Filter/__tests__/fromObject-test.js +++ b/web/client/utils/ogc/Filter/__tests__/fromObject-test.js @@ -38,6 +38,10 @@ const COMPARISON_TESTS = [ cql: "PROP like 'a'", expected: 'PROPa' }, + { + cql: "PROP ilike 'a'", + expected: 'PROPa' + }, { cql: "PROP between 1 and 3", expected: 'PROP13'