I am worried this is a bit expensive.
Plus I will soon implement a normalized system for the tags so there will be additional joins.
On top of that I have 4 tables (tbl_videos, tbl_articles, tbl_galleries and tbl_users) of which I want to display three results of each and thus will have to run the query four times on one press of 'search'.
SELECT *,
(
(CASE WHEN `description` LIKE '%hotel%' THEN 1 ELSE 0 END) +
(CASE WHEN `description` LIKE '%london%' THEN 1 ELSE 0 END) +
(CASE WHEN `description` LIKE '%lazy%' THEN 1 ELSE 0 END) +
(CASE WHEN `description` LIKE '%dog%' THEN 1 ELSE 0 END) +
(CASE WHEN `title` LIKE '%hotel%' THEN 1 ELSE 0 END) +
(CASE WHEN `title` LIKE '%london%' THEN 1 ELSE 0 END) +
(CASE WHEN `title` LIKE '%lazy%' THEN 1 ELSE 0 END) +
(CASE WHEN `title` LIKE '%dog%' THEN 1 ELSE 0 END) +
(CASE WHEN `tags` LIKE '%hotel%' THEN 1 ELSE 0 END) +
(CASE WHEN `tags` LIKE '%london%' THEN 1 ELSE 0 END) +
(CASE WHEN `tags` LIKE '%lazy%' THEN 1 ELSE 0 END) +
(CASE WHEN `tags` LIKE '%dog%' THEN 1 ELSE 0 END)
) AS relevance
FROM `table`
WHERE `description` LIKE '%hotel%'
OR `description` LIKE '%london%'
OR `description` LIKE '%lazy%'
OR `description` LIKE '%dog%'
OR `title` LIKE '%hotel%'
OR `title` LIKE '%london%'
OR `title` LIKE '%lazy%'
OR `title` LIKE '%dog%'
OR `tags` LIKE '%hotel%'
OR `tags` LIKE '%london%'
OR `tags` LIKE '%lazy%'
OR `tags` LIKE '%dog%'
ORDER BY relevance DESC
LIMIT 0 , 3;