Search code examples
sqlfull-text-searchphpmyadminmyisam

full text search doesn't find anything


**EDIT**

ok so i found the problam, it was that the min word length for the search was 4, i changed it to 3 but now it only finds the row 1 data and not row 2 data aswell...

-----original question:----

I have a MyISAM table on my phpmyadmin like this:

table name: `users`
coulmn name: `name`
row 1 data: 'dan'
row 2 data: 'dan252'

(it's just the important part of it)

now the name is fulltext index field, im using this query:

SELECT * FROM `users` WHERE MATCH(`name`) AGAINST('dan')

but phpmyadmin returns:

MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0004 sec )

why it's not finding anything?

*EDIT*

ok so i found the problam, it was that the min word length for the search was 4, i changed it to 3 but now it only finds the row 1 data and not row 2 data aswell...


Solution

  • MATCH only works on columns with FULLTEXT indicing. And FULLTEXT indicing only works on MyISAM tables.

    Secondly, 'dan' is probably too short to use on a MATCH.

    Thirdly, if your search term matches more than 50% of your rows, the term is considered too common and the search fails.

    Have a read here.