Open main menu


Available from version 1.21.0 (Gerrit change 31402)
If there was no match for the exact result. This runs before lettercase variants are attempted, whereas SearchGetNearMatch runs after.
Define function:
public static function onSearchAfterNoDirectMatch( string $term, &$title ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"SearchAfterNoDirectMatch": "MyExtensionHooks::onSearchAfterNoDirectMatch"

For MediaWiki ≤1.25:

$wgHooks['SearchAfterNoDirectMatch'][] = 'MyExtensionHooks::onSearchAfterNoDirectMatch';
Called from:File(s): search/SearchNearMatcher.php
Function(s): getNearMatchInternal

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:SearchAfterNoDirectMatch extensions.


  • $term: Search term string
  • &$title: A Title object, return false for a match