Manual:Hooks/SpecialSearchResults

Category:MediaWiki hooks#SpecialSearchResults Category:Hooks added in MediaWiki 1.13.0#SpecialSearchResults
SpecialSearchResults
Available from version 1.13.0
called before search result display when there are matches
Define function:
public static function onSpecialSearchResults( $term, $titleMatches, $textMatches ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SpecialSearchResults": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialSearchResults"
	}
}
Called from: File(s): specials/SpecialSearch.phpCategory:MediaWiki hooks included in SpecialSearch.php#SpecialSearchResults
Interface: SpecialSearchResultsHook.php

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

Details

  • $term: string of search term
  • $titleMatches: empty or SearchResultSet object
  • $textMatches: empty or SearchResultSet object

Old behaviour

Referenced SearchResultSet can be easily wrapped for any purpose (caching results, etc). Please keep in mind that old behavior used no reference for SearchResultSet objects.

See also

Category:Hooks added in MediaWiki 1.13.0 Category:MediaWiki hooks Category:MediaWiki hooks included in SpecialSearch.php