SELECT
    user_id, username, email, 
    GREATEST (
        similarity (email, $1),
        similarity (username, $1)
    ) as "similarity!"
FROM
    users
ORDER BY
    "similarity!" DESC
LIMIT 20