Montag, 27 Juni 2011 15:45

K2 and Why you need a good Joomla Web Host

Rate this item
(0 votes)

Three character search with K2

When you search a Joomla web site your search is limited to a minimum of 3 characters but with K2 that might not always be true and you will find that you are not

getting all the search results that you would expect.

On this site there are at least two three letter search terms that are very popular, SEF and ACL. Out of the box and on a non joomla/k2-optimized web server ACL will produce 2 hits, and SEF will produce zero hits. But on a Joomla blog like this one that is obviously not correct. Try it for yourself now and you will get the correct number of hits.

Bug or Feature

It took me a while to track down the reason for this sometime last year and I see many K2 sites that are not running on K2 optimized web servers and which have incorrect search results.

The search plugin used with K2 is coded slightly differently to regular Joomla search plugins as it uses BOOLEAN mode. I'm not 100% sure why it does this but I suspect it is considerably more efficient on sites with a large amount of content than a LIKE query which default Joomla search plugins use.

The problem with using BOOLEAN mode is that it relies on a MySQL variable called ft_min_word_len which has a default value of 4.

[NOTE: The upcoming K2 2.5 for Joomla 1.6 also uses Boolean search]

So how come you got some search results

This is the bit that really confused me for a while until I realised that on the article where I did get search hits it was not because the word ACL was on the page but because there were longer words with the three letters (ACL) in them, in my case it was in the url links eg aclhints.com

So K2 will happily search for three letters, like the rest of Joomla, but the ft_min_word_len stops the search from looking inside words with less than 4 characters.

How can I check my server

The easiest way is if you have access to phpMyAdmin and on the home page of it there is an option called Show MySQL system variableswhere you can see all the variable settings.

How to fix it

The only way to change this is if you have access to my.cnf on the server where you can change the value of the ft_min_word_len to 3 and then restart the mysql server. If you make this change then you will also need to rebuild your FULLTEXT indexes in mysql, but at least then you will have a working search.

Or if you have a great web host who understands all the requirements of great Joomla Hosting they will have already done this for you.

This week I moved the Hosting of all my sites to iRedHOST and it was great to see that they had already set up their servers correctly to handle this.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.