| Search |
| Perform a full text search |
| Prefix |
sr |
| Required rights |
none |
| Post only? |
No |
Parameters[edit]
- info – What metadata to return.
- Type: one of totalhits, suggestion
- limit – How many total pages to return. Type: limit
- namespace – The namespace(s) to enumerate. Type: namespace
- offset – Use this value to continue paging (return by query). Type: integer
- prop – What properties to return:
- 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
- snippet - Adds a parsed snippet of the page
- titlesnippet - Adds a parsed snippet of the page title
- redirectsnippet - Adds a parsed snippet of the redirect
- redirecttitle - Adds a parsed snippet of the redirect title
- sectionsnippet - Adds a parsed snippet of the matching section
- sectiontitle - Adds a parsed snippet of the matching section title
- hasrelated - Indicates whether a related search is available
- Type: one of size, wordcount, timestamp, score, snippet, titlesnippet, redirecttitle, redirectsnippet, sectiontitle, sectionsnippet, hasrelated
- redirects – Include redirect pages in the search. Type: bool
- search (required) – Search for all page titles (or content) that has this value. Type: string
- what – Search inside the text or titles:
- title - Search in page titles (default) (if search engine doesn't support title searches, such as Lucene which is used by Wikipedia, then
srwhat=title falls back to text)
- text - Search in page text
- nearmatch - Search for the exact title
Depending on which search backend is in use, how
srsearch is interpreted may vary. On Wikimedia wiki's which use Lucene search, see
w:Help:Searching#Search_engine_features for information about the search syntax.
Error Codes[edit]
- invalidtitle – Bad title ``key''.
- invalidtitle – Bad title ``title''.
- nosearch – The search parameter must be set.
- This was param-search before 1.17
- readapidenied – You need read permission to use this module.
- search-text-disabled – text search is disabled.
- search-title-disabled – title search is disabled.
Example[edit]
Show a list of 10 pages that contain the word 'wikipedia'
| Result |
| The following content has been placed in a collapsed box for improved usability. |
<?xml version="1.0"?>
<api>
<query>
<searchinfo totalhits="40085" />
<search>
<p ns="0" title="Wikipedia" timestamp="2011-02-26T16:43:03Z" />
<p ns="0" title="French Wikipedia" timestamp="2011-02-27T00:11:59Z" />
<p ns="0" title="Main Page" timestamp="2011-01-19T19:49:11Z" />
<p ns="0" title="Regent" timestamp="2011-02-24T03:45:02Z" />
<p ns="0" title="Blocking of Wikipedia by the People's Republic of China" timestamp="2011-02-25T03:12:52Z" />
<p ns="0" title="Nemzeti Bajnokság I" timestamp="2011-02-02T23:27:44Z" />
<p ns="0" title="Teller–Ulam design" timestamp="2011-02-06T21:54:56Z" />
<p ns="0" title="Norwegian Wikipedia" timestamp="2011-01-06T18:43:32Z" />
<p ns="0" title="List of countries and outlying territories by total area" timestamp="2011-02-26T17:31:44Z" />
<p ns="0" title="2009–2010 ISU Junior Grand Prix" timestamp="2011-02-19T04:24:52Z" />
</search>
</query>
<query-continue>
<search sroffset="10" />
</query-continue>
</api>
|
| The above content has been placed in a collapsed box for improved usability. |
See also[edit]