SELECT
    site,
    date,
    is_read,
    title,
    uid,
    name
FROM
    post p
    JOIN feed f ON p.site = f.slug
WHERE
    ($1::text IS NULL OR site = $1)
    AND (
        NOT $2
        OR NOT is_read
    )
    AND (
      $5 :: text IS NULL
      OR to_tsvector('english', summary) @@ websearch_to_tsquery('english', $5)
    )
ORDER BY
    date DESC,
    title OFFSET $3
LIMIT
    $4
