Advertisement
vojtarek

Full Text Higlight Search

May 25th, 2011
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.40 KB | None | 0 0
  1. SELECT
  2. rank,
  3. q AS query,
  4. SOURCE,
  5. id,
  6. ts_headline('dutch', title, q) AS title,
  7. ts_headline('dutch', text, q) AS text
  8.  
  9. FROM (
  10.  
  11. SELECT
  12. ts_rank_cd(fts, q) AS rank,
  13. sources.SECTION AS SOURCE,
  14. documents.id,
  15. title,
  16. text,
  17. q
  18.  
  19. FROM
  20. documents,
  21. sources,
  22. to_tsquery('dutch', 'Bauchschmerzen') q
  23.  
  24. WHERE
  25. sources.id=documents.source_id AND
  26. documents.fts @@ q
  27. AND documents.LANGUAGE='de'
  28. ORDER BY rank DESC
  29. LIMIT 20
  30. ) AS foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement