I am trying to make a search engine for my school project website but I'm having trouble ordering the results.
The sample table looks like this:
id | title
1 | Bulok Enrollment System
2 | Bulok Enrollment System Again
3 | Bulok Inventory System
4 | Bulok Invetory System Again
If I searched the keyword 'bulok again' then row 2 and 4 should appear on first than row 1 and 2.
Here is the query I use for the searching:
SELECT DISTINCT *, COUNT(*) as count FROM research WHERE (title LIKE '%again%' OR title LIKE '%bulok%') GROUP BY id ORDER BY count DESC
where 'count' should be the one counting the occurence of the words on the title but I can't get it to work. My table is InnoDB btw, just in case.
Thanks in advance.