Open main menu


Available from version 0.7.2 (r73342)
Allow messing with various search parameters before search client is instantiated
Define function:
public static function onSphinxSearchBeforeResults( &$term, &$offset, &$namespaces, &$categories, &$exc_categories ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"SphinxSearchBeforeResults": "MyExtensionHooks::onSphinxSearchBeforeResults"

For MediaWiki ≤1.25:

$wgHooks['SphinxSearchBeforeResults'][] = 'MyExtensionHooks::onSphinxSearchBeforeResults';
Called from:File(s): SphinxMWSearch.php

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


  • $term: string search term(s)
  • $offset: integer results page offset
  • $namespaces: array of namespace ids to include
  • $categories: array of category ids to include
  • $exc_categories: array of category ids to exclude