【发布时间】:2016-06-07 04:26:45
【问题描述】:
使用 Wikipedia API 的搜索功能:
我只想接收与字符串完全匹配的结果,但是,这不是返回的结果。
如何在 API 中引发这种行为?
【问题讨论】:
标签: php wikipedia-api
使用 Wikipedia API 的搜索功能:
我只想接收与字符串完全匹配的结果,但是,这不是返回的结果。
如何在 API 中引发这种行为?
【问题讨论】:
标签: php wikipedia-api
leo 说的没什么可补充的:维基百科现在使用 CirrusSearch 扩展,所以在使用 search API 时,您必须参考 https://mediawiki.org/wiki/Help:CirrusSearch#Prefer_phrase_matches,它告诉您 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"
}
]
}
}
【讨论】: