Steps to replicate the issue:
On Wikimedia Commons, do a deepcategory search on a category with a space in the name. You can perform the search on either Special:MediaSearch or directly via the API.
Example API call for a deepcat search on Category:Wikipedia_23_cakes:
https://commons.wikimedia.org/w/api.php?action=query&format=json&uselang=en&generator=search&gsrsearch=filetype:bitmap%20deepcategory:%22Wikipedia%2023%20cakes%22&gsrlimit=40&gsroffset=0&gsrinfo=totalhits|suggestion&gsrprop=size|wordcount|timestamp|snippet&prop=info|imageinfo|entityterms&inprop=url&gsrnamespace=6&iiprop=url|size|mime&iiurlheight=180&wbetterms=label
Each time I make the API call, I get back one of two possible responses, both of which have issues.
What happens?:
I most frequently get a 200 back with this body (which is incorrect, as there are results in the category):
{"batchcomplete":"","query":{"searchinfo":{"totalhits":0}}}
If I retry a few times, I eventually do get back results, but with deepcat search failing:
{
"batchcomplete":"",
"warnings":{
"search":{
"*":"Deep category search SPARQL query failed"
}
},
"query":{
"searchinfo":{
"totalhits":30
},
"pages":{
"144728426":{
"pageid":144728426,
...I tried hitting this search 10 times in a row as a test. These were the results:
- 0 results
- 0 results
- 0 results
- Results but deepcat failed
- 0 results
- Results but deepcat failed
- 0 results
- 0 results
- Results but deepcat failed
- 0 results
What should have happened instead?:
Results returned without the deep category search SPARQL query failing.
Other information (browser name/version, screenshots, etc.):
This issue has been brought up on the Wikimedia Commons technical village pump here.