Jump to content

Manual:Enabling autocomplete in search box

From mediawiki.org

Autocomplete or Search suggestions is a feature that displays a drop-down list of suggestions below the search box while text is being typed. On the MediaWiki platform, this feature is provided by making queries to the Opensearch API.

The built-in autocomplete feature

[edit]
Example of a autocomplete

MediaWiki version 1.20+:

Enabled by default. Can be disabled the same as in 1.19. $wgEnableMWSuggest has been removed.

MediaWiki version 1.13 to 1.19:

$wgUseAjax = true;
$wgEnableMWSuggest = true;

$wgUseAjax : is set true by default.
$wgEnableMWSuggest : If you are using any version above 1.19 and also using Vector as your skin, you can also set $wgVectorUseSimpleSearch = true; instead of $wgEnableMWSuggest = true;.

To disable the autocomplete feature either disable all of $wgUseAjax , or disable only the search suggestions by hiding preference disablesuggest and setting the default to true.

MediaWiki version 1.8 to 1.12:

$wgUseAjax = true;
$wgAjaxSearch = true;

MediaWiki versions 1.6 and 1.7:

$wgUseAjax = true;

See also

[edit]
  • TitleKey (formerly used by Wikipedia): Makes the prefix search backend case-insensitive (which affects Opensearch API and search suggestions).
  • SphinxSearch: Smaller sites might want to consider using this instead of Lucene-search. It uses the Sphinx Search Engine as the back-end. As-you-type suggestions are available in version 0.8.2 (svn r9671) and above (This will only work in MediaWiki 1.18+)
  • CirrusSearch (used by Wikipedia)
  • Manual:Enabling autocomplete in a form: for developers, a tutorial on how to add autocomplete to any form.