Please, help me to change the search. I need to search by username instead of user_id.
This is my query:
-- [params]
-- string :query = white_check_mark
-- integer :user
-- date :start_date
-- date :end_date
SELECT created_at, topic_id, p.id as post_id FROM posts p
LEFT JOIN post_search_data psd ON psd.post_id = p.id
WHERE psd.search_data @@ TO_TSQUERY(:query)
AND user_id = :user
AND p.created_at BETWEEN :start_date::date
AND :end_date::date