Manual:Hooks/SearchAfterNoDirectMatch

From Linux Web Expert

SearchAfterNoDirectMatch
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 31402)</tvar></translate>
If there was no match for the exact result. This runs before lettercase variants are attempted, whereas SearchGetNearMatch runs after.
<translate> Define function:</translate>
public static function onSearchAfterNoDirectMatch( string $term, &$title ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"SearchAfterNoDirectMatch": "MediaWiki\\Extension\\MyExtension\\Hooks::onSearchAfterNoDirectMatch"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> search/SearchNearMatcher.php
<translate> Function(s):</translate> getNearMatchInternal
<translate> Interface:</translate> SearchAfterNoDirectMatchHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:SearchAfterNoDirectMatch extensions</tvar>.</translate>


Details

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