Extension:Wildcard search
|
|
This extension is obsolete! It has been replaced by core functionality in the MediaWiki software. |
|
Wildcard search Release status: unknown |
|||
|---|---|---|---|
| Implementation | Search | ||
| Description | Adds wildcard search capability | ||
| Author(s) | Assela Pathirana | ||
| Last version | Fork of this - copied 22/7/07 | ||
| MediaWiki | 1.6.7 and higher | ||
| License | No license specified | ||
| Download | No link | ||
|
|||
|
Check usage (experimental) |
|||
Early Mediawiki releases did not allow wildcard searches by default (e.g. a wildcard search for rabbi* will return pages with rabbit, rabbits or rabbi), but this can easily be turned on, see below.
This wildcard search is standard now, at least since release 1.12, if not earlier.
[edit] How to turn on the wildcard search in early MW releases?
It would be possible to do this by changing several lines 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.
- First save this file as SearchMySQLwildcards.php in a sub-folder (let's say 'wildcardsearch' ) of the extensions directory.
<?PHP #Copyright (C) 2006 Assela Pathirana under the version 2 of the GNU General Public License #Adds wildcard search functionality to mediawiki # file : SearchMySQLwildcards.php require_once( 'SearchEngine.php' ); require_once( 'SearchMySQL.php' ); //Register this search type and override the default search set in DefaultSettins.php $wgSearchType = 'SearchMySQLwildcards'; //Create a new search class based on the parent class SearchMySQLwildcards extends SearchMySQL { public static function legalSearchChars() { //include + and * as valid characters return "A-Za-z_'0-9\\x80-\\xFF\\-+*"; } } $strictMatching=false; $wgExtensionCredits['other'][] = array( 'name' => 'Wildcard search', 'version' => '071002', 'author' => 'Assela Pathirana', 'description' => 'adds wildcard search capability', 'url' => 'http://www.mediawiki.org/wiki/Extension:Wildcard_search' ); ?>
- Then add the following to the end of your LocalSettings.php file
require_once("$IP/extensions/wildcardsearch/SearchMySQLwildcards.php");
- Note
- The present code is for MySQL database type. For others changes are necessary.
[edit] Compatibility
For MW 1.8.3 remove public static before legalSearchChars() function declaration.
For MW 1.7.1 remove public static before legalSearchChars() function declaration.
[edit] Change log
- 11:29, 2 October 2007 (UTC) Fixed and removed code errors mentioned here
- 08:56, 8 August 2007 (UTC) Fixed the code error mentioned here
- 08:32, 10 October 2006 (JST) Made a minor change to make the code compatible with 1.7.1 version of mediawiki. Thanks to Lars Pontoppidan for the suggestion.
