Jump to content

Manual:Hooks/SearchAfterNoDirectMatch

From mediawiki.org
SearchAfterNoDirectMatch
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onSearchAfterNoDirectMatch"
	}
}
Called from: File(s): search/SearchNearMatcher.php
Function(s): getNearMatchInternal
Interface: SearchAfterNoDirectMatchHook.php

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


Details

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