MySQL has supported FULLTEXT indexes since version
3.23.23. VARCHAR and TEXT
Columns that have been indexed with FULLTEXT can be
used with special SQL statements that perform the full text
search in MySQL.
To get started you need to define the FULLTEXT index
on some columns. Like other indexes, FULLTEXT
indexes can contain multiple columns. Here's how you might add a
FULLTEXT index to some table columns:
ALTER TABLE news ADD FULLTEXT(headline, story);
Once you have a FULLTEXT index, you can search it
using MATCH and AGAINST statements. For
example:
SELECT headline, story FROM news
WHERE MATCH (headline,story) AGAINST ('Hurricane');
The result of this query is automatically sorted by relevancy.
MATCH
The MATCH function is used to …