I'm using MySQL 5.5.31 I wan to use MATCH() and AGAINST() functions. For it I run following queries in phpMyAdmin:
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
) ENGINE=MyISAM;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
('MySQL table','The database is very large');
For searching the string 'database' I run following query:
SELECT * FROM articles
WHERE MATCH (title,body)
AGAINST ('database' IN NATURAL LANGUAGE MODE);
It returned all the three rows from the table containing word 'database'. But when I search for other string like 'the' it's not returning me anything. It's returning null. I'm not understanding why this is happening? Also if the string to be searched is present in title column it's returning null. Can anyone clear my these two doubts please? Thanks in advance.
MySQL has a 4 character minimum limit for search in fulltext mode.
http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html
ft_min_word_length
variable can be changed.Here it is the full stopword list for a future reference.
http://dev.mysql.com/doc/refman/5.5/en/fulltext-stopwords.html
What are stopwords? http://dev.mysql.com/doc/refman/5.1/en/fulltext-natural-language.html