Brian's Blog Homepage
Searching the Greek way
Searching the Greek way

You have probably noticed that this web site uses the awesome component K2 to deliver the content that you are reading instead of the default Joomla com_content component.

But did you know that to truly make it work you need a web host that understand exactly how to configure a web server to work with it?

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.

J o o m l a !

Brian Teeman

Brian Teeman

Who is Brian?

As a co-founder of Joomla! and OpenSourceMatters Inc I've never been known to be lacking an opinion or being too afraid to express it.

Despite what some people might think I'm a shy and modest man who doesn't like to blow his own trumpet or boast about achievements.

Where is Brian?