From MediaWiki.org
Jump to navigation Jump to search
This page is part of the MediaWiki action API documentation.

MediaWiki action API

v · d · e

Search titles and text.


  • srsearch: Search for all page titles (or content) that have this value.
  • srnamespace: The namespace(s) to enumerate. No more than 50 (500 for bots) allowed. (Default: 0)
  • srwhat: Search inside the text or titles. (Default: title (if search engine doesn't support title searches, such as Lucene which was previously used by Wikipedia, then srwhat=title falls back to text))
    • title: Search in page titles
    • text: Search in page text
    • nearmatch: Search for a near match in the title 1.17+
  • srinfo: What metadata to return. Possible values: totalhits, suggestion. (Default: totalhits|suggestion) 1.16+
  • srprop: What properties to return. (Default: size|wordcount|timestamp|snippet) 1.16+
    • size: Adds the size of the page in bytes
    • wordcount: Adds the word count of the page
    • timestamp: Adds the timestamp of when the page was last edited
    • score: Adds the score (if any) from the search engine 1.17+ (Deprecated in 1.24)
    • snippet: Adds a parsed snippet of the page
    • titlesnippet: Adds a parsed snippet of the page title 1.17+
    • redirecttitle: Adds a parsed snippet of the redirect title 1.17+
    • redirectsnippet: Adds a parsed snippet of the redirect 1.17+
    • sectiontitle: Adds a parsed snippet of the matching section title 1.17+
    • sectionsnippet: Adds a parsed snippet of the matching section 1.17+
    • hasrelated: Indicates whether a related search is available 1.17+ (Deprecated in 1.24)
  • srredirects: Include redirect pages in the search. From 1.23 onwards, redirects are always included. (Default: false) (Removed in 1.23)
  • sroffset: Use this value to continue paging (returned by query). Note the underlying search engine may impose a maximum on the total number of results that may be fetched through continuation.
  • srlimit: How many total pages to return. No more than 50 (500 for bots) allowed. (Default: 10)
  • srinterwiki: Include interwiki results in the search, if available. (Default: false) 1.23+
  • srbackend: Class name of search backend to use (Default: $wgSearchType) 1.22+
Depending on which search backend is in use, how srsearch is interpreted may vary. On Wikimedia wikis which use CirrusSearch, see Help:CirrusSearch for information about the search syntax.

Error codes[edit]

Result Meaning
nosearch The search parameter must be set.
This was param-search before 1.17
search-text-disabled text search is disabled.
search-title-disabled title search is disabled.
search-error search error has occurred.


Search for "Albert Einstein" (defaults to title search), returning default search information with UTF8 characters

Show a list of 10 pages that contain the word "wikipedia", returning their timestamp; request information to search for the next 10 matches

See also[edit]