Manual:Hooks/SearchIndexFields

SearchIndexFields
Available from version 1.28.0
Add fields to search index mapping
Define function:
public static function onSearchIndexFields( array &$fields, SearchEngine $engine ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SearchIndexFields": "MyExtensionHooks::onSearchIndexFields"
	}
}
Called from: File(s): SearchEngine.php
Interface: SearchIndexFieldsHook.php

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


DetailsEdit

  • array &$fields: Array of fields, all implement SearchIndexField.
  • SearchEngine $engine: SearchEngine instance for which mapping is being built.

Extension that wants to add a field to search index mapping can use this hook to inject search fields.