MySQL全文检索 MATCH AGAINST
MySQL全文检索 MATCH AGAINST is a SQL function in the MySQL Specific category. MySQL full-text search: natural language or boolean mode search with relevance ranking. The syntax is SELECT * FROM table WHERE MATCH(col1, col2) AGAINST('search text' IN BOOLEAN MODE);. It accepts col1, col2. It returns full-text search results. A typical example: CREATE FULLTEXT INDEX ft_idx ON articles (title, body); -- Natural Language Mode (default): SELECT title, MATCH(title, body) AGAINST('database optimization') AS relevance FROM articles WHERE MATCH(title, body) AGAINST('database optimization'); -- Returns results ordered by relevance automatically -- Boolean Mode (operators): SELECT * FROM articles WHERE MATCH(title, body) AGAINST('+database -sql AND (optimization OR tuning)' IN BOOLEAN MODE); -- + required, - excluded, () grouping -- * wildcard: 'optim*' -- > < for… A close relative is AUTO_INCREMENT, which mySQL auto-generates sequential integer values for this column. Commonly used with PRIMARY KEY. A close relative is ENGINE, which specifies the MySQL storage engine. InnoDB (default) supports transactions and foreign keys. MyISAM is faster for read-heavy.