I have a table with articles and a table with categories. Each category has a number of keywords and I want to use those keywords to determine if an article belongs to a certain category.
I'm using the query below:
SELECT
path,
title,
description,
keywords
FROM
(
SELECT
path,
keywords,
(select title from article where id = 164016) as title,
(select description from article where id = 164016) as description
FROM
categories c
) as x
WHERE
MATCH (title, description) AGAINST ('my keywords' IN BOOLEAN MODE)
For some reason this query is not working because of incorrect paramaters with MATCH but I can't figure out what it is.
Use boolean fulltext search to enable exact matching on an expression. However, there are some limitations to such searches, as described by the documentation linked above:
The above also means that if you have a stop word or a word shorter than the minimum length in the search expression, then MySQL will not return any matches.
If you want completely exact matches, then you cannot use fulltext search. You either need to use the
like
operator or the=
operator.UPDATE
title
in this case is a calculated field which does not have a fulltext index.against()
(source)
You have a field name in the
against()
function, which is not allowed.