API:Search and discovery

MediaWiki, its extensions, and its sibling projects hold tremendous potential for knowledge discovery through search. The mechanisms, tools, and services for doing so are maintained by the Search and Discovery team.

Searching MediaWiki
The quickest way to find information in MediaWiki is to look it up directly.

Navigating Wikidata
Get started by reading Help:Navigating_Wikidata.

api.php
The MediaWiki web has several search-related modules. You can make requests and view generated help at any wiki's /w/api.php entry point, or fill in API request parameters at Special:ApiSandbox.

Search modules

 * action=opensearch
 * See API:Opensearch. Returns search results in OpenSearch format, each with text extract  on Wikimedia projects.   View generated API help


 * action=languagesearch
 * Search for language names in any script. View generated API help

Query list submodules
These return a list of wiki pages matching the search criteria, and some additional information. Furthermore, you can use each as a generator to provide many other  Properties of the set of returned pages, such as a lead image, snippet, and/or page description.


 * action= list=prefixsearch
 * This merely returns wiki page titles with the given prefix. See Showcase article  Page info in search results.  View generated API help.


 * action=query list=search
 * See API:Search page. The main search interface, on Wikimedia wikis it provides search results from CirrusSearch, it can return typical search result information such as text snippets and page size.   View generated API help


 * action=query list=geosearch
 * See showcase article Showing nearby wiki information.  View generated API help.

Wikidata query service
Wikidata query service is a work in progress to allow graph-based searching of Wikidata via RDF.

CirrusSearch API
CirrusSearch is a MediaWiki extension to enable Elastic-based search of MediaWiki content.

Wikidata
Another axis for search results is to query Wikidata items, referenced by identifiers of the form, where   is an integer greater than or equal to 1. For example, the Albert Einstein article on Wikipedia is associated with the Wikidata item with the identifier. This is available to JavaScript on the wiki page via ).

Given an item, you can query the Wikidata wiki for, e.g.  to get language-independent information about it. For example, claims about Albert Einstein are available through /w/api.php?action=wbgetclaims&entity=Q937.

You can also query for  to get basic entity information such as the   of the concept in the local language. Note that this is also available by querying any local wiki page for. For example, /w/api.php?action=wbgetentities&ids=Q937 returns the  of German-American physicist and founder of the theory of relativity.