Files
libredesk/internal/search/queries.sql
T
Abhinav Raut 0c01b53b09 feat(conversations): add trigram index for searching ref numbers
feat(messages): add trigram index for text content search
- feat: UI animations for conversation and messages list.
- Simplify websocket updates.
2025-01-19 23:10:53 +05:30

18 lines
551 B
SQL

-- name: search-conversations
SELECT
conversations.created_at,
conversations.uuid,
conversations.reference_number,
conversations.subject
FROM conversations
WHERE reference_number::text = $1;
-- name: search-messages
SELECT
c.created_at as "conversation_created_at",
c.reference_number as "conversation_reference_number",
c.uuid as "conversation_uuid",
m.text_content
FROM conversation_messages m
JOIN conversations c ON m.conversation_id = c.id
WHERE m.type != 'activity' and m.text_content ILIKE '%' || $1 || '%';