I am building a website with articles section, I am looking for a search functionality that will search the article title and the article content for results that contain all search term, and then will return article result that contains the search term words such as the following example: Search Term: "Facebook tweaks News Feed to clamp down on 'spammy' and misleading advertising".
It will be ideal to return all result that matches the exact term, then search by more relevant result such as "Facebook tweaks News Feed" etc.
The following is the code I did so far:
"p.Title,p.ID,p.Publish_Date, p.Sponsored, p.Featured, p.Seo_Link, p.Content,
(SELECT GROUP_CONCAT(t.Tag_ID)
FROM Tag_Post_Relationship t
WHERE p.ID = t.Post_ID) AS Tags,
MATCH (Title, Content) AGAINST ('".$search_term."'IN BOOLEAN MODE) AS Relevance FROM Posts p WHERE NOT Post_Type = 'p' AND Publish_Date < '{$dateNow}' AND Visibility = 'p' AND
(MATCH (p.Title, p.Content) AGAINST ('".$search_term."' IN BOOLEAN MODE))
ORDER BY Relevance DESC"