2

Fore some reasons mysql match doesn't find anything. I have such table:

CREATE TABLE IF NOT EXISTS `phrases` (
  `question` varchar(250) CHARACTER SET utf8 NOT NULL,
  `answer` text NOT NULL,
  FULLTEXT KEY `question` (`question`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `phrases` (`question`, `answer`) VALUES
('Hello Hello', 'Hello'),
('Hi', 'Hello'),
('Hola', 'Hello');

And when I try:

select match(question) against('Hello') from phrases

Results are zero. But what's interesting, if I try this:

select match(question) against('Hola') from phrases

It gives 0.6852666139602661 for question 'Hola'

Vasya
  • 260
  • 1
  • 2
  • 13

1 Answers1

1

This is because mysql full text search has a stop word list https://dev.mysql.com/doc/refman/5.5/en/fulltext-stopwords.html

which contains some common words which will be ignored for the search. Hence you are getting no result for Hello

If you want to disable that follow this for myisam engine ignoring mysql fulltext stopwords in query

Community
  • 1
  • 1
Abhik Chakraborty
  • 44,654
  • 6
  • 52
  • 63
  • Thank you very much. I am making chat bot for online support and Hello was just first word I tried how it works, and it looked like nothing is working. – Vasya Feb 28 '16 at 19:26