MediaWiki API 幫助
這是自動(dòng)生成的MediaWiki API文檔頁(yè)面。
文檔和例子:https://www.mediawiki.org/wiki/API:Main_page/zh
list=search (sr)
- 此模塊需要讀取權(quán)限。
- 此模塊可作為發(fā)生器使用。
- 來(lái)源:MediaWiki
- 許可協(xié)議:GPL-2.0+
執(zhí)行一次全文本搜索。
參數(shù):
- srsearch
搜索所有匹配此值的頁(yè)面標(biāo)題或內(nèi)容。根據(jù)wiki的搜索后端工具,您可以使用搜索字符串以調(diào)用特殊搜索功能。
- 這個(gè)參數(shù)是必須的。
- srnamespace
只在這些名字空間搜索。
- 值(以|分隔):0、1、2、3、4、5、6、7、8、9、10、11、12、13、14、15、2300、2301、2302、2303
- 默認(rèn):0
- srwhat
要執(zhí)行的搜索類型。
- 以下值中的一個(gè):title、text、nearmatch
- srinfo
要返回的元數(shù)據(jù)。
- 值(以|分隔):totalhits、suggestion、rewrittenquery
- 默認(rèn):totalhits|suggestion|rewrittenquery
- srprop
要返回的屬性:
- size
- 添加頁(yè)面大小,單位為字節(jié)。
- wordcount
- 添加頁(yè)面的字?jǐn)?shù)。
- timestamp
- 添加頁(yè)面上次編輯時(shí)的時(shí)間戳。
- snippet
- Adds a parsed snippet of the page.
- titlesnippet
- Adds a parsed snippet of the page title.
- redirecttitle
- Adds the title of the matching redirect.
- redirectsnippet
- Adds a parsed snippet of the redirect title.
- sectiontitle
- Adds the title of the matching section.
- sectionsnippet
- Adds a parsed snippet of the matching section title.
- isfilematch
- Adds a boolean indicating if the search matched file content.
- categorysnippet
- Adds a parsed snippet of the matching category.
- score
- 已棄用并已忽略。
- hasrelated
- Deprecated and ignored.
- 值(以|分隔):size、wordcount、timestamp、snippet、titlesnippet、redirecttitle、redirectsnippet、sectiontitle、sectionsnippet、isfilematch、categorysnippet、score、hasrelated
- 默認(rèn):size|wordcount|timestamp|snippet
- sroffset
當(dāng)更多結(jié)果可用時(shí),使用這個(gè)繼續(xù)。
- 類型:整數(shù)
- 默認(rèn):0
- srlimit
返回的總計(jì)頁(yè)面數(shù)。
- 不允許超過500個(gè)(對(duì)于機(jī)器人則是5,000個(gè))。
- 類型:整數(shù)或max
- 默認(rèn):10
- srinterwiki
搜索結(jié)果中包含跨wiki結(jié)果,如果可用。
- 類型:布爾值(詳細(xì)信息)
- srenablerewrites
啟用內(nèi)部查詢重寫。一些搜索后端可以重寫查詢到它認(rèn)為會(huì)給出更好結(jié)果的地方,例如糾正拼寫錯(cuò)誤。
- 類型:布爾值(詳細(xì)信息)
例子:
- 搜索meaning。
- api.php?action=query&list=search&srsearch=meaning [在沙盒中打開]
- 搜索文本meaning。
- api.php?action=query&list=search&srwhat=text&srsearch=meaning [在沙盒中打開]
- 獲得有關(guān)搜索meaning返回頁(yè)面的頁(yè)面信息。
- api.php?action=query&generator=search&gsrsearch=meaning&prop=info [在沙盒中打開]