Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Tips and Tricks arrow #14 - Optimize the default search options

Print E-mail

#14 - Optimize the default search options

By default the Joomla search searches for any word. That is if you look for "Joomla components", you will find any page which contains either Joomla or components. People require AND search. The following hack to the core code will enable all words searching by default.

In /components/com_search/search.html.php:

Find:               $searchphrase     = strtolower( strval( mosGetParam( $_REQUEST, 'searchphrase', 'any' ) ) );
Change to:      $searchphrase     = strtolower( strval( mosGetParam( $_REQUEST, 'searchphrase', 'all' ) ) );
This occurs twice in approximaletely lines 126 and 215

Also, in /components/com_search/search.php: 

Find:            $searchphrase = mosGetParam( $_REQUEST, 'searchphrase', 'any' );

Change to:   $searchphrase = mosGetParam( $_REQUEST, 'searchphrase', 'all' );
This occurs in approximately line 103

Rememer to make a backup of each files in case something goes wrong. 

Comments
Add NewSearchRSS
Write comment
Name:
Title:
Security Image
 

Subscribe to our feed


RSS Feed

DART Creations - Joomla Tutorials, Tips and Tricks and more...

Joomla Tips

DART Creations Joomla Tips, Tricks, tutorials and general Joomla help

Sponsors

Buy us a beer!

Lots of time and effort goes into creating and maintaining this site. If we've helped you, consider buying a beer. It will inspire us to keep on giving! Thanks! (€3)






Cheers ;)