Full-Text Indexes
Full-text indexes enable natural language search across text columns. They are far faster than LIKE '%word%' and support relevance ranking.
Full-text indexes enable natural language search across text columns. They are far faster than LIKE '%word%' and support relevance ranking.
CREATE TABLE articles (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
body TEXT,
FULLTEXT(title, body)
);
-- Or add to existing table
ALTER TABLE articles ADD FULLTEXT idx_search (title, body);
Full-text indexes work on InnoDB (MySQL 5.6+) and MyISAM tables.