MATCH is the core of MySQL and MariaDB full-text search. It compares a search expression against text stored in FULLTEXT-indexed columns. When used in a SELECT list, MATCH...AGAINST returns a relevance score (a floating-point value); when placed in a WHERE or HAVING clause, it filters rows whose relevance is greater than zero. Search behavior changes with the chosen modifier: IN NATURAL LANGUAGE MODE ranks by term frequency, IN BOOLEAN MODE interprets operators like +, -, and *, and WITH QUERY EXPANSION reruns the search with related terms to widen recall. Only columns of type CHAR, VARCHAR, or TEXT that belong to a FULLTEXT index can participate. Searches are case-insensitive for non-binary collations, ignore stopwords, and apply minimum length rules (4 characters by default). MATCH works only on MyISAM, InnoDB, and Aria engines that support FULLTEXT. It cannot reference columns from different tables or be combined with ordinary comparison operators.
column_list
(list) - One or more FULLTEXT-indexed CHAR, VARCHAR, or TEXT columns.search_expr
(string) - The search phrase enclosed in quotes.modifier
(enum) - Optional mode|||IN NATURAL LANGUAGE MODE (default), IN BOOLEAN MODE, WITH QUERY EXPANSION, or IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION.AGAINST, FULLTEXT INDEX, BOOLEAN MODE, INNODB, NATURAL LANGUAGE MODE, CONTAINS (SQL Server)
MySQL 3.23 (1999)
NATURAL LANGUAGE MODE ranks results purely by statistical relevance without interpreting special symbols. BOOLEAN MODE treats +, -, *, ~, and parentheses as operators, giving you fine-grained control over inclusion, exclusion, wildcards, and weighting.
Yes. MATCH only works on columns that belong to a FULLTEXT index. Add one with ALTER TABLE ... ADD FULLTEXT (col1, col2);
List higher-priority columns first in the MATCH column list, or multiply the returned relevance score by a weight in the SELECT clause (e.g., MATCH(title) AGAINST (...) * 2).
Absolutely. You can filter by MATCH score and other columns simultaneously, such as WHERE MATCH(content) AGAINST ('sql') AND status = 'published';