fix(analytics): replace regexp_split_to_table with UNNEST+STRING_TO_ARRAY and fix regex escapes
This commit is contained in:
@@ -323,15 +323,15 @@ export class AnalyticsRepository {
|
|||||||
LOWER(TRIM(BOTH '.,!?;:\"()[]{}' FROM word)) AS word,
|
LOWER(TRIM(BOTH '.,!?;:\"()[]{}' FROM word)) AS word,
|
||||||
ai_moderation_score
|
ai_moderation_score
|
||||||
FROM messages,
|
FROM messages,
|
||||||
LATERAL regexp_split_to_table(content, E'\\\\s+') AS word
|
LATERAL UNNEST(STRING_TO_ARRAY(content, ' ')) AS word
|
||||||
${filter.where}
|
${filter.where}
|
||||||
AND content IS NOT NULL
|
AND content IS NOT NULL
|
||||||
AND content != ''
|
AND content != ''
|
||||||
AND LENGTH(TRIM(BOTH '.,!?;:\"()[]{}' FROM word)) >= 3
|
AND LENGTH(TRIM(BOTH '.,!?;:\"()[]{}' FROM word)) >= 3
|
||||||
AND word !~ '^<.+:\\d+>$'
|
AND word !~ '^<.+:\\d+>$'
|
||||||
AND word !~ '^https?://'
|
AND word !~ '^https?://'
|
||||||
AND word !~ '^discord\\.(gg|app|com)'
|
AND word !~ '^discord\.(gg|app|com)'
|
||||||
AND word !~ '^cdn\\.discord'
|
AND word !~ '^cdn\.discord'
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
word AS topic,
|
word AS topic,
|
||||||
|
|||||||
Reference in New Issue
Block a user