Joomla 2.5 – How to Increase the Search Character Limit

by Elaine on March 23, 2012

Joomla 2.5 Tutorial – I don’t know why Joomla decided to make these values so hard to change.  In Joomla 2.5, there is a minimum and maximum search word limit.  The minimum search character length is 3 and maximum is 20.  This tutorial is for Mario who left me a comment under an older post and asked me how to Increase the Search Character Limit in Joomla 2.5.   I searched everywhere to change this value, and took me over an hour to finally find the solution.

cmsmind joomla 2 5 increase search character limit 2 Joomla 2.5   How to Increase the Search Character Limit

Joomla 2.5 - Search Character Limit is 20

Problem: How to Change Search Box:

  • Minimum SearchWord Character Limit = 3; Want to change it to 1
  • Maximum SearchWord Character Limit = 20; Want to Increase it to 50

High Level Solution:

  • Use FTP Manager to Edit files or
  • SSH into your domain file directory and edit the file

../language/[site-language]/[site-language].localise.php

  • Change the limit values

Follow the detail steps below to Decrease/Increase the Minimum and Maximum Search Character Limit:

1.  FTP or SSH into your Domain and Change Directory

Use your FTP Manager or SSH into your domain.  You will need to edit files that are not editable in the Joomla 2.5 administrator backend.

  • Use FTP Manager or SSH into your Domain name
  • change directory to – /language/[site-language]
  • Edit your – [site-language].localise.php
  • For example, I have an english site, so I will edit the following file:

../language/en-GB/en-GB.localise.php

2.  Change the Limit Values

If you SSH into your Domain, use your favourite editor, example pico or VI.  Pico would probably easier.  FTP Manager is best for those who do not know how to use either.  In the file en-GB.localise.php, do the following:

a.  Decrease the Minimum Search Character Limit – currently 3 change to 1

cmsmind joomla 2 5 change minimum search character limit 1 Joomla 2.5   How to Increase the Search Character Limit

Joomla 2.5 - Change Minimum Search Character Limit from 3 to 1

  • Search for the following code

public static function getLowerLimitSearchWord() {
return 3;
}

  • Change the code to the following – in red:

public static function getLowerLimitSearchWord() {
//Elaine CmsMind.com Mar 22, 2012 – Change Min Search Character limit to 1
//return 3;
return 1;
}

b.  Increase the Maximum Search Character Limit – currently 20 change to 50

cmsmind joomla 2 5 increase maximum search character limit Joomla 2.5   How to Increase the Search Character Limit

Joomla 2.5 - How to Increase the Search Character Limit from 20 to 50

  • Search for the following code

public static function getUpperLimitSearchWord() {
return 20;

}

  • Change the code to the following – in red:

public static function getUpperLimitSearchWord() {
//Elaine CmsMind.com Mar 22, 2012 – Change Max Search Character limit 50
//return 20;
return 50;

}

Save the file and refresh your Joomla 2.5 website.  I tested it and now I can add more characters to my search box.

Thanks.  I hope this helps you.  Let me know if you need more clarification.

Elaine

 Joomla 2.5   How to Increase the Search Character Limit

Elaine

Elaine is the founder of CmsMind, an online blog providing Joomla and Wordpress tutorials. Elaine lives in Toronto and when she is not online, she is either Marathon and Triathlon training or travelling and racing somewhere in the world. Find her also at: Save Money, Premium Themes and Templates, and at Webhosting Tips.

More Posts - Website

{ 13 comments… read them below or add one }

Chris Clay March 30, 2012 at 6:49 pm

Thanks for this! I found an older tutorial for Joomla 1.5 which led me astray. I never even realized Joomla restricted searches to 20 characters until a client complained about it today. Do you know if we can put the en-GB.localise.php file in the new language overrides folder, so it won’t be overwritten each time Joomla is upgraded?

Cheers,
Chris

Reply

adib April 12, 2012 at 1:47 am

Hi,
in our directory can not found en-GB.localise.php file.

Reply

Elaine April 12, 2012 at 4:05 am

Hi Adib,
What language are you using?
Elaine

Reply

Danny April 17, 2012 at 9:42 am

Super!!!!

Reply

Lisa August 14, 2012 at 5:23 pm

This is GREAT!! It did the trick for me. Thank you so much!!!!

Reply

Elaine August 15, 2012 at 2:14 am

Hi Lisa,
No problem! Glad I was able to help.
Thanks for your visit,
elaine

Reply

Ryan September 6, 2012 at 2:04 am

Thanks Elaine, that’s nice.

As an added consideration, were migrating a massive site, and expecting a huge 404 fallout.
I’m working on the concept of being able to grab the existing url from Google, grab the page title, and put that into the searchbox (hence I was looking to increase the limit of the text and found your site 😉

here’s some example code, play and modify to suit

<?php
$requri = getenv ("REQUEST_URI");
$servname = getenv ("SERVER_NAME");
echo "Page not found: ” . $servname . $requri ;
?>
<?php
$urlContents = file_get_contents("http://webcache.googleusercontent.com/search?q=cache:&quot;. $servname . $requri);
preg_match("/(.*)/i”, $urlContents, $matches);
print($matches[1] . “\n”); // “Example Web Page”
?>

<input name="searchword" id="mod-search-searchword" maxlength="50" class="inputbox" type="text" size="35" value="” onblur=”if (this.value==”) this.value=’Search…’;” onfocus=”if (this.value==’Search…’) this.value=”;”>

Reply

me August 5, 2013 at 5:00 pm

thanks

Reply

sandro August 26, 2013 at 8:14 am

Thanks, that work fine for me, this is the best solution to increase the joomla search

Reply

JRD September 28, 2013 at 11:35 am

Elaine dear..You have always been an angel to me as far as my joomla issues are concerned..Thanks again

Reply

Elaine October 3, 2013 at 6:08 pm

Hi JRD,
Thanks for your kind comment. 🙂
elaine

Reply

Bhaumik K. October 1, 2014 at 12:08 pm

Great, It worked for me 😀

Reply

joomla search component maximum symbols November 23, 2015 at 11:05 pm

Increased the Search Character Limit in Joomla 2.5 by changing digits in a file you mentioned) thx

Reply

Leave a Comment

Captcha Captcha Reload

Older Post:

Newer Post: