我正在尝试搜索包含特定
title
和 Coord
模板的页面。
然而,我的行为很奇怪。
例如,搜索
Taj Mahal
,以下查询会返回不错的结果。
https://en.wikipedia.org/w/api.php?
action=query&
format=json&
list=search&
formatversion=2&
srlimit=10&
sroffset=0&
srsearch=hastemplate:Coord intitle:Taj&
srprop=
{
"batchcomplete": true,
"continue": {
"sroffset": 10,
"continue": "-||"
},
"query": {
"searchinfo": {
"totalhits": 60,
"suggestion": "tai",
"suggestionsnippet": "tai"
},
"search": [
{
"ns": 0,
"title": "Taj Mahal",
"pageid": 82976
},
{
"ns": 0,
"title": "Taj Mahal Palace Hotel",
"pageid": 1983963
},
{
"ns": 0,
"title": "Taj Mahal Bangladesh",
"pageid": 20579666
},
{
"ns": 0,
"title": "Black Taj Mahal",
"pageid": 39649287
},
{
"ns": 0,
"title": "Taj Connemara",
"pageid": 33725911
},
{
"ns": 0,
"title": "Taj-ul-Masajid",
"pageid": 10014406
},
{
"ns": 0,
"title": "Taj-e Dowlatshah",
"pageid": 38190785
},
{
"ns": 0,
"title": "Taj ol Din Kola",
"pageid": 40983978
},
{
"ns": 0,
"title": "Taj Kuh, Zirkuh",
"pageid": 35936872
},
{
"ns": 0,
"title": "Taj-ol Dowleh-ye Muziraj",
"pageid": 40918093
}
]
}
}
但是,当我期待标题中带有
Taj Ma
的文章时,以下查询没有返回结果:
https://en.wikipedia.org/w/api.php?
action=query&
format=json&
list=search&
formatversion=2&
srlimit=10&
sroffset=0&
srsearch=hastemplate:Coord intitle:Taj Ma&
srprop=
{
"batchcomplete": true,
"query": {
"searchinfo": {
"totalhits": 0,
"suggestion": "tai",
"suggestionsnippet": "tai"
},
"search": []
}
}
甚至奇怪的是,以下查询返回
Rowgir-e Taj Amiri
但忽略了其他所有内容,包括 Taj Mahal
https://en.wikipedia.org/w/api.php?
action=query&
format=json&
list=search&
formatversion=2&
srlimit=10&
sroffset=0&
srsearch=hastemplate:Coord intitle:Taj Mah&
srprop=
{
"batchcomplete": true,
"query": {
"searchinfo": {
"totalhits": 1,
"suggestion": "tai",
"suggestionsnippet": "tai"
},
"search": [
{
"ns": 0,
"title": "Rowgir-e Taj Amiri",
"pageid": 41773498
}
]
}
}
类似地,查询
Taj Maha
返回 Taj Coromandel
但忽略其他所有内容,包括 Taj Mahal
** 我在尝试这种搜索许多其他地方的模式时发现了类似的行为,例如
London
。
除非我没有正确理解这个 API 的工作原理,否则我希望
Taj Mahal
出现在我所做的搜索请求的每个响应中。
intitle:Taj Ma
表示“标题包含“Taj”且标题或文字包含“Ma”的每个页面。
intitle:"Taj Ma"
。然而,这也不会返回任何内容,大概是因为 MediaWiki 认为 Taj Ma
不是 Taj Mahal
的 子短语。
intitle:/Taj Ma/
。