From cbee35c3486ef9e3d75942ca21f133b956ea86db Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Wed, 3 Jun 2026 19:55:43 +0700 Subject: [PATCH] fix(analytics): replace regexp_split_to_table with UNNEST+STRING_TO_ARRAY and fix regex escapes --- .../backend/src/modules/analytics/analytics.repository.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/backend/src/modules/analytics/analytics.repository.ts b/services/backend/src/modules/analytics/analytics.repository.ts index caf90b4..2c93e12 100644 --- a/services/backend/src/modules/analytics/analytics.repository.ts +++ b/services/backend/src/modules/analytics/analytics.repository.ts @@ -323,15 +323,15 @@ export class AnalyticsRepository { LOWER(TRIM(BOTH '.,!?;:\"()[]{}' FROM word)) AS word, ai_moderation_score FROM messages, - LATERAL regexp_split_to_table(content, E'\\\\s+') AS word + LATERAL UNNEST(STRING_TO_ARRAY(content, ' ')) AS word ${filter.where} AND content IS NOT NULL AND content != '' AND LENGTH(TRIM(BOTH '.,!?;:\"()[]{}' FROM word)) >= 3 AND word !~ '^<.+:\\d+>$' AND word !~ '^https?://' - AND word !~ '^discord\\.(gg|app|com)' - AND word !~ '^cdn\\.discord' + AND word !~ '^discord\.(gg|app|com)' + AND word !~ '^cdn\.discord' ) SELECT word AS topic,