Error Code: 1064 syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' MYSQL

Viewed 5176

I am trying to run below query on my innoDB table and getting error.

Query :

SELECT `Job`.`id`, `Job`.`job_description`, `Job`.`job_title`,
       `Company`.`name`, `Company`.`url`
FROM `jobs` AS `Job` 
    LEFT JOIN `companies` AS `Company` ON (`Company`.`id` = `Job`.`company_id` 
        AND `Job`.`company_id` = `Company`.`id`) 
WHERE `Job`.`status` = 1 
AND `Company`.`status` = 1
AND ( MATCH(`Job`.`job_title`) AGAINST ('*' IN NATURAL LANGUAGE MODE) )
ORDER BY `Job`.`id` ASC LIMIT 20

Error :

Error Code: 1064
syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*'
1 Answers

AGAINST('*' ...) is not valid. Fulltext expects to see word(s), not a lone wildcard.

If this is coming from data input, and the user is asking to "see everything", then construct a different query for that. It would probably look the same, but leaving out the MATCH line.

Related