1

I have problem searching products less than 4 characters using magento built-in search. I try to search and most of it suggest to modify my.cnf. Unfortunately i use sahared hosting and modifying my.cnf isn't possible. In this case how to make searching less than 4 characters possible? Are there any free extensions to do this?

Any help is appreciated.Thanks in advance. Thank you Agung.

3
  • 2
    Would be helpful if you could post something like an error message, or what exacly is happening. If you get an error like "Minimum Search query length is 4" that is from Magento and can be modified from Dashboard under under System > Configuration > CATALOG > Catalog > Catalog Search > Minimal Query Length
    – Emi
    Aug 24, 2013 at 12:22
  • i didn't get error message. Minimal query length: 1, Search Type: Fulltext
    – Agung Santoso
    Aug 24, 2013 at 13:05
  • 1
    Minimal Query Length does not change the mysql service configuration but is only used to set Magento's queries to what the service has been set to. Aug 25, 2013 at 0:54

2 Answers 2

6

The full text index in MySQL indexes only words that are over a minimum value. By Default that value is 4 but (like you already found) it can be changed from my.cnf. The name of this variable is ft_min_word_len.
I don't think an extension can help you on this since is a MySQL setting. You can either convince your hosting provider to change this or you should change the search type to Like or Like & Fulltext.(System->Configuration).
Off topic a bit:
You shouldn't use Magento with a shared host. They don't play well together.

2
  • This is a MySQL DBA question. The setting is at the MySQL database engine level. All Magento extensions will effectively be trying to change something under a locked hood (something they don't have access to due to permissions and security). Not gonna happen. my.cnf needs to be updated and the MySQL service reloaded to pull in the parameter from the config file. Implementing Magento under shared hosting not optimized for Magento operations as a business plan is a plan to fail. Aug 25, 2013 at 0:52
  • I already try change search type to Like or Like & Fulltext, but the result is same for search terms less than 4 characters. I decided to use magento advanced search, it solve my problem. But why they don't implement it on simple search?
    – Agung Santoso
    Aug 26, 2013 at 7:43
0

Edit the MySQL configuration file my.cnf which is usually located on a *nix box at /etc/my.cnf or /etc/mysql/my.cnf and add the following line under the [mysqld] section to change the default to 3 or 2 or what you want.

ft_min_word_len = 3

If the ft_min_word_len value is already in the file then change the number to the minimum length required. After making this change the MySQL server must be restarted for it to take effect.

Now that the minimum word length has changed, and new or updated records will use the new minimum word length, but existing records will not be affected. To rebuild the full text index on a column for an catalogsearch_fulltext, run this query:

REPAIR TABLE catalogsearch_fulltext QUICK;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.