Increasing the Joomla 1.5 Search Component character limitation
The default character limitation for the native Joomla! Search Module is 20 characters. Increasing this value requires a bit of Joomla! hacking, and although there are a number of resources for accomplishing this, I could not find any that pertained to the current (or even recent) Joomla 1.5 release.
NOTE: You should not remove the maxlength entirely. As long as search times are non-critical to you, and your database is not enormous, making it 50 or 100 characters should make for a more appealing search interface in most cases.
In order to change the search character limitation to 45, make the following changes:
Note: The ” – -” means delete this, and the “++” means to add this back
/modules/mod_search.php
-- $maxlength = $width > 20 ? $width : 20; ++ $maxlength = $width > 45 ? $width : 45;
/components/com_search/views/search/tmpl/default_form.php
-- ++
/administrator/components/com_search/helpers/search.php
-- // limit searchword to 20 characters
-- if ( JString::strlen( $searchword ) > 20 ) {
-- $searchword = JString::substr( $searchword, 0, 20 );
++ // limit searchword to 45 characters
++ if ( JString::strlen( $searchword ) > 45 ) {
++ $searchword = JString::substr( $searchword, 0, 44 );
/language/en-GB/en-GB.com_search.ini
-- SEARCH_MESSAGE=Search term must be a minimum of 3 characters and a maximum of 20 characters. ++ SEARCH_MESSAGE=Search term must be a minimum of 3 characters and a maximum of 45 characters.
There you have it, enjoy!
Thanks to the following:
leeburstroghm – for pointing out that this change requires mods to the admin component in order to function properly on the front-end.
m2d^ – for a helpful post that accomplished this update in an older version of Joomla! / the Joomla! Search Component. It’s close, but just distinct enough to make things tricky.
[...] Großteil des Codes stammt von http://www.geekgumbo.com! (theoretisch) ähnliche Beiträge:WordPress – Fatal error: Allowed memory [...]