Skip to content

Instantly share code, notes, and snippets.

@scottlowe
Created April 27, 2011 20:30
Show Gist options
  • Save scottlowe/945129 to your computer and use it in GitHub Desktop.
Save scottlowe/945129 to your computer and use it in GitHub Desktop.
SQL generated by ARel query in example app
SELECT title, body, id
FROM articles, to_tsquery('pg_catalog.english', 'hot|monkeys') as q
WHERE (tsv @@ q)
ORDER BY ts_rank_cd(tsv, q) DESC
LIMIT 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment