fulltext_search
🗂️ Implementing Full-Text Search for Natural Language Queries
Full-text indexes allow efficient searching for words or phrases in text columns using MATCH ... AGAINST
. You can perform boolean searches or natural language ranking. Ensure you set appropriate minimum word length and stopwords.
ALTER TABLE articles ADD FULLTEXT(title, body);
SELECT *, MATCH(title, body) AGAINST('database optimization' IN NATURAL LANGUAGE MODE) AS score
FROM articles
WHERE MATCH(title, body) AGAINST('database optimization');