Manual:Enabling autocomplete in search box

Autocomplete or Search suggestions is a feature that displays a drop-down list of suggestions bellow the Search box while text is being typed. On the MediaWiki platform, this feature is provided by Ajax asynchronous queries to the database. Although the basic feature is quite limited, it can be greatly enhanced with the addition of extensions.

Using the basic feature


Edit the file LocalSettings.php and add the following entries:

MediaWiki versions 1.6 and 1.7:

MediaWiki version 1.8 to 1.12:

MediaWiki version 1.13 and above:


 * Notes:
 * The basic feature is case-sensitive, i.e, with the exception of the first letter which is always treated as an upper case, all other letters must be typed with exactly the same case of the searched item;
 * $wgUseAjax defaulted to false until MW 1.10, when it was changed to true;
 * $wgAjaxSearch was introduced in MW 1.8 and replaced by $wgEnableMWSuggest in MW 1.13;

Using advanced features
The advanced features require the installation of one or more extensions.

Adding case-insensitivity
Since the introduction of the auto autocomplete feature, one of the main requests was to make it case-insensitive. It was finally accomplished via a third-party extension, TitleKey, still in use by Wikipedia. Configure the basic settings above according to your version of the MediaWiki. and then install the TitleKey extension.

Extending the search capabilities
If you want a more powerful search suggestion feature, similar to the one seen in the image beside, you will have to resort to other extensions that enhance the searching capabilities of the MediaWiki.

Lucene-search
One such extension is Lucene-search, a search engine back-end for large MediaWiki websites which allows for distributed search and indexing, accentless search, stemmers for 12+ languages, link analysis for ranking, and namespace-prefixed queries. It is the search engine used by Wikimedia wikis.

Lucene-search requires a front-end extension to fetch the results from the search engine:

MediaWiki versions prior to 1.13:
 * Install LuceneSearch

MediaWiki version 1.13 and above:
 * Install MWSearch

SphinxSearch
Smaller sites might want to consider using SphinxSearch 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.

After installation, the following settings are required in LocalSettings.php: