1

I've read loads of tips on Magento search but still cant get it to find 3 character words. I'm unable to mod mysql as I'm on shared hosting. The confusing thing (for me !) is that if I search for the same 3 character word in my prestashop it finds it no problem.

Magento is finding 4 character words no problem at all. I've set the Magento minimum characters for search, to 1. I've modded Fulltext.php to AND instead of OR. I've tried Like, Fulltext and combined.

Not sure what else I can do. Would be grateful for any tips. Thanks

nigelt
  • 11
  • 3

2 Answers2

0

I think the problem is you're on a shared hosting. Magento uses MyISAM tables for search beacause of the fulltext indexing. As you can see here http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html you have to tweak the ft_min_word_len=3 to have it search for 3 letter words. 4 is the default value in most mysql configs. What you can do is change the table to be on a different engine (InnoDB) but you'd loose the benefits of the fulltext index. I don't know the structure of Prestashop's db, but I would guess they are using InnoDB.

Emi
  • 1,018
  • 9
  • 13
  • I've just checked and you're absolutely spot on. Prestashop does indeed use InnoDB. Back to the drawing board then :-( Thanks for your help – nigelt Mar 27 '14 at 10:00
0

You’ll probably also need to change the mySQL full text word length variable ft_min_word_len. By default this value is 4, resulting in 3 character words not being indexed. To change the full text word length variable to 3 add this to your my.cnf:

[mysqld]
ft_min_word_len=3

Restart mysql

service mysqld restart

Finally reindex the magento catalog, you can do this via GUI or command line.

$php magento/shell/indexer.php reindexall

After the reindex completes you should be able to search your magento store successfully with 3 character search terms. To Locate the my.cnf file on ubuntu, please refer the link below

how to know mysql my.cnf location

my.cnf

You can then check the values in phpMyAdmin under "Show MySQL system variables" to make sure your changes have taken place.

Phpmyadmin variable search

Community
  • 1
  • 1
Dave
  • 25
  • 7