Following on from this answer I want to know what the best way to use PostgreSQL\'s built-in full text search is if I want to sort by rank, and limit to only matching q
select *
from (
SELECT
pictures.id,
ts_rank_cd(to_tsvector('english', pictures.title),
to_tsquery('small dog')) AS score
FROM pictures
) s
WHERE score > 0
ORDER BY score DESC