With this relevance query i am trying to select/find a tag tags
.tag
'computational thinking' by querying a part 'computational' from articles
.id
16, however it doesnt seem to find more than one tag. Once i search for 'almere' it does give the desired article result (article
.id
16 and 15)
SELECT s.seoUrl, a.*,
(
(
if (t.tag LIKE '%computational%',7,0)
)+
(
if (a.title LIKE '%computational%',5,0)
)+
(
if (a.shortDescription LIKE '%computational%',4,0)
)+
(
if (a.content LIKE '%computational%',3,0)
)+
(
if (m.name LIKE '%computational%',2,0)
)+
(
if (s.seoUrl LIKE '%computational%',1,0)
)
) as relevance
FROM articles a
LEFT JOIN article_tag at ON at.articleId = a.contentId
LEFT JOIN seoUrls s ON s.contentId = a.contentId
LEFT JOIN tags t ON at.tagId = t.contentId
LEFT JOIN article_category ac ON ac.articleId = a.contentId
LEFT JOIN menu m ON m.contentId = ac.categoryParentId
WHERE a.published = 'on'
GROUP BY a.contentId
HAVING relevance > 0
ORDER BY relevance DESC, a.views DESC
i think i made a massive mistake with the left joins within the selection of tags but i can't seem to find a solution, any ideas?