You are here:  » 3 letter words


3 letter words

Submitted by henk on Thu, 2013-01-17 08:18 in

Hi David,

How can i make the search quicker on three letters:

Example Ugg is very slow.

Thank You,
Henk

Submitted by support on Thu, 2013-01-17 12:23

Hello Henk,

Queries containing 3-letter words (or less) don't use the Full Text index code as they are not included in the full text by default. I think you're running VPS and so should have control over the MySQL configuration. Please see the following page for fine tuning information which you may find useful:

http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html

In particular, making the change to my.cnf

[mysqld]
ft_min_word_len=3

It's that's an option for you, to apply to the changes in search look for the following code at line 220 of pto_search.php

if (strlen($word) <= 3 || in_array(strtolower($word),$pto_stopwords))

...and REPLACE with:

if (strlen($word) <= 2 || in_array(strtolower($word),$pto_stopwords))

However, if it looks like you don't have control over the MySQL configuration, please email me your existing pto_search.php as I know you have quite a few customisations and I'll look at the 3 letters or less search code and advise what might be able to be changed to speed things up...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Thu, 2013-01-17 20:58

Hi David,

It's running :)

Thx
Henk

Submitted by sociallyfamous on Thu, 2015-03-12 20:46

Hi David,

As I am going through all the threads to learn as much as possible, I do leave a comment here and there. :)

I have the same problem, that words of 2 and 3 letters can take a minute to load and if there is a solution I would love to know too.

I have some access to the mysql settings but it goes via the hosting company. They are very careful about changing settings.

Submitted by support on Fri, 2015-03-13 09:37

Hi,

The real speed-up for queries with short words is the FULLTEXT minimum word length modification to MySQL. As mentioned above this would need to go in my.cnf so would probably need to be implemented by your hosting support - don't forget to restart MySQL after making the change and then a full import will be required as the full text index is only constructed at INSERT time.

Currently, FULLTEXT is not if any keyword in the query is less than the minimum word length, but I am experimenting with a new search option where a query contains at least one word of minimum length, using that in a FULLTEXT sub-query and the basic search method against the shorter keywords against the results of that. If it turns out to be effective I'll incorporate this into the next version of the plugin.

Cheers,
David.
--
PriceTapestry.com

Submitted by sociallyfamous on Fri, 2015-03-13 12:49

OK. I've contacted the hosting company. Lets see. Thanks for that.