Return to Snippet

Revision: 42895
at March 12, 2011 08:37 by ezerick


Initial Code
SELECT title, filename, sum(relevance)
FROM (
SELECT title, filename, 10 AS relevance FROM page WHERE title like ‘%about%’
UNION
SELECT title, filename, 7 AS relevance FROM page WHERE filename like ‘%about%’
UNION
SELECT title, filename, 5 AS relevance FROM page WHERE keywords like ‘%about%’
UNION
SELECT title, filename, 2 AS relevance FROM page WHERE description like ‘%about%’
) results
GROUP BY title, filename
ORDER BY relevance desc;

Initial URL
http://www.jarrodgoddard.com/web-development/advanced-web-site-search-with-sql

Initial Description

                                

Initial Title
Relevance-based Site Search with SQL | JarrodGoddard.com

Initial Tags

                                

Initial Language
SQL