From 99d62fa54943932bb962d0c58b63789cc505122d Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 28 Mar 2025 16:52:08 +0100 Subject: [PATCH] feat(chalice): support regex operator for heatmaps --- api/chalicelib/core/metrics/heatmaps/heatmaps_ch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/chalicelib/core/metrics/heatmaps/heatmaps_ch.py b/api/chalicelib/core/metrics/heatmaps/heatmaps_ch.py index e37450e36..519f6ddcb 100644 --- a/api/chalicelib/core/metrics/heatmaps/heatmaps_ch.py +++ b/api/chalicelib/core/metrics/heatmaps/heatmaps_ch.py @@ -24,8 +24,9 @@ def get_by_url(project_id, data: schemas.GetHeatMapPayloadSchema): "main_events.`$event_name` = 'CLICK'", "isNotNull(JSON_VALUE(CAST(main_events.`$properties` AS String), '$.normalized_x'))" ] - - if data.operator == schemas.SearchEventOperator.IS: + if data.operator == schemas.SearchEventOperator.PATTERN: + constraints.append("match(main_events.`$properties`.url_path'.:String,%(url)s)") + elif data.operator == schemas.SearchEventOperator.IS: constraints.append("JSON_VALUE(CAST(main_events.`$properties` AS String), '$.url_path') = %(url)s") else: constraints.append("JSON_VALUE(CAST(main_events.`$properties` AS String), '$.url_path') ILIKE %(url)s")