Nishant Saini
Nishant Saini

Reputation: 431

very strange error in mysql . match against search is working but for right it is not working

this is working fine if,I search for right button its not giving any result.But data exist in database

SELECT *
FROM tblcodes
WHERE MATCH(search_term) AGAINST('+left* +button* ' in BOOLEAN MODE) OR
      code LIKE '%left button%'

please give any suggestion

Upvotes: 1

Views: 55

Answers (1)

Solarflare
Solarflare

Reputation: 11106

The word right is contained in the MyISAM fulltext stopword list. This means it won't be added to the fulltext index because it is assumed to be too common in english texts to actually help identifying content. So you cannot find it using match against (but you would still find it using like).

To change that behaviour, you can modify or disable that list:

To override the default stopword list for MyISAM tables, set the ft_stopword_file system variable. (See Section 6.1.5, “Server System Variables”.) The variable value should be the path name of the file containing the stopword list, or the empty string to disable stopword filtering. The server looks for the file in the data directory unless an absolute path name is given to specify a different directory. After changing the value of this variable or the contents of the stopword file, restart the server and rebuild your FULLTEXT indexes.

You can also switch to InnoDB, it uses a much shorter default stopword list, although this might just divert the problem until you are looking for e.g. about.

Upvotes: 1

Related Questions