SELECT
    COUNT(*) 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', summary) @@ websearch_to_tsquery('english', $3)
    )
