Using the search functionality of the Wikipedia API :
I would like to only receive results which exactly match the string, however, that is not what is being returned.
How do I induce this behavior in the API?
Using the search functionality of the Wikipedia API :
I would like to only receive results which exactly match the string, however, that is not what is being returned.
How do I induce this behavior in the API?
There's not much to add to what leo said: Wikipedia now uses the CirrusSearch extension, so when using the 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"
}
]
}
}