维基百科 API 全文搜索:仅 return 完全匹配
Wikipedia API full text search: only return exact matches
使用维基百科的搜索功能API:
我只想接收与字符串完全匹配的结果,但是,这不是返回的结果。
如何在 API 中引发这种行为?
leo 说的没什么可补充的:维基百科现在使用 CirrusSearch 扩展,所以当使用 search API you must refer to https://mediawiki.org/wiki/Help:CirrusSearch#Prefer_phrase_matches which tells you to use quotation marks:
{
"batchcomplete": "",
"continue": {
"sroffset": 1,
"continue": "-||"
},
"query": {
"searchinfo": {
"totalhits": 1100
},
"search": [
{
"ns": 0,
"title": "Woman in a Purple Coat",
"snippet": "costume, surrounded by a complex of abstract design and exotic color. <span class=\"searchmatch\">This</span> <span class=\"searchmatch\">is</span> <span class=\"searchmatch\">an</span> <span class=\"searchmatch\">example</span> of one of the final groups of oil paintings in Matisse's career, in",
"size": 1347,
"wordcount": 96,
"timestamp": "2016-10-20T16:52:48Z"
}
]
}
}
使用维基百科的搜索功能API:
我只想接收与字符串完全匹配的结果,但是,这不是返回的结果。
如何在 API 中引发这种行为?
leo 说的没什么可补充的:维基百科现在使用 CirrusSearch 扩展,所以当使用 search API you must refer to https://mediawiki.org/wiki/Help:CirrusSearch#Prefer_phrase_matches which tells you to use quotation marks:
{
"batchcomplete": "",
"continue": {
"sroffset": 1,
"continue": "-||"
},
"query": {
"searchinfo": {
"totalhits": 1100
},
"search": [
{
"ns": 0,
"title": "Woman in a Purple Coat",
"snippet": "costume, surrounded by a complex of abstract design and exotic color. <span class=\"searchmatch\">This</span> <span class=\"searchmatch\">is</span> <span class=\"searchmatch\">an</span> <span class=\"searchmatch\">example</span> of one of the final groups of oil paintings in Matisse's career, in",
"size": 1347,
"wordcount": 96,
"timestamp": "2016-10-20T16:52:48Z"
}
]
}
}