Difference between revisions of "Wildcard Search Extension"
From assela Pathirana
Jump to navigationJump to search
Line 3: | Line 3: | ||
==How to== | ==How to== | ||
#<nowiki> | #First save this file as in a sub-folder of extensions directory.<nowiki> | ||
</nowiki><pre><nowiki> | </nowiki><pre><nowiki> | ||
<?PHP | |||
#Copyright (C) 2006 Assela Pathirana under the version 2 of the GNU General Public License | |||
#Adds wildcard search functionality to mediawiki | |||
require_once( 'SearchMySQL4.php' ); | |||
//Register this search type and override the default search set in DefaultSettins.php | |||
$wgSearchType = SearchMySQLwildcards; | |||
/** Provide the search class */ | |||
class SearchMySQLwildcards extends SearchMySQL4 { | |||
function legalSearchChars() { | |||
//include + and * as valid characters | |||
return "A-Za-z_'0-9¥¥x80-¥¥xFF¥¥-+*"; | |||
} | |||
} | |||
$strictMatching=false; | |||
?> | |||
</nowiki></pre> | |||
Revision as of 05:55, 22 March 2006
Background
By default Mediawiki does not allow wildcard searches by default, but this can be easily turned on. It is possible to do this by changing several line in the Mediawiki code. However, this is not a recommended way, as it will create problems at future updates, etc. This 'extension' allows doing the same without changing the core mediawiki code.
How to
- First save this file as in a sub-folder of extensions directory.
<?PHP
- Copyright (C) 2006 Assela Pathirana under the version 2 of the GNU General Public License
- Adds wildcard search functionality to mediawiki
require_once( 'SearchMySQL4.php' ); //Register this search type and override the default search set in DefaultSettins.php $wgSearchType = SearchMySQLwildcards; /** Provide the search class */ class SearchMySQLwildcards extends SearchMySQL4 {
function legalSearchChars() { //include + and * as valid characters return "A-Za-z_'0-9¥¥x80-¥¥xFF¥¥-+*"; }
} $strictMatching=false; ?>