SELECT id, message -> 'text' FROM raw_messages WHERE channels[1] IN (SELECT c.pubsub_channel_name FROM conversation_participants AS cp JOIN conversations AS c ON c.id = cp.conversation_id WHERE user_id = 30) AND to_tsvector(message -> 'text') @@ to_tsquery('HVAC');