Reputation: 17322
I'm trying to make a search-function only with SQL, but right now I only get results witch matches in the content. If the title of an article matches with the searchstring it will be ignored, but I do not see why.
SELECT title, LEFT(content, 200) as content, MATCH(title, content) AGAINST (:searchstr) AS score
FROM table
WHERE MATCH(title, content) AGAINST(:searchstr IN BOOLEAN MODE) ORDER BY score DESC
If the title matches with the searchstring it should get a higher score to display the title-matches first, because they should be more relevant... How can I do that?
Upvotes: 1
Views: 51
Reputation: 17322
I found a solution here: Fulltext search against multiple columns
Upvotes: 1