SELECT COUNT(*) AS count
FROM
    post
WHERE
    (
        $1::text IS NULL
        OR site = $1
    )
    AND (
        NOT $2
        OR NOT is_read
    )
    AND (
        $3::text IS NULL
        OR TO_TSVECTOR('english', search_summary)
        @@ WEBSEARCH_TO_TSQUERY('english', $3)
    )
