Page MenuHomePhabricator

List type queries treat empty datasets inconsistently
Closed, ResolvedPublic

Description

Author: stephen.bain

Description:
Allows the backlinks query to return the standard data structure when the query returns an empty dataset.

Some list type queries return the standard data structure but an empty dataset when, because of a supplied parameter, the query returns no results, for example, the categorymembers query:

http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmcategory=NonExistentCategory
<?xml version="1.0" encoding="utf-8"?>
<api>

<query>
  <categorymembers />
</query>

</api>

However some don't return the standard data structure, for example, the backlinks query:

http://www.mediawiki.org/w/api.php?action=query&list=backlinks&bltitle=NonExistentPage
<?xml version="1.0" encoding="utf-8"?>
<api />

And in another varient, although the usercontribs query returns the standard data structure with an empty dataset when a nonexistent user is specified, the logevents query returns an error when a nonexistent user is specified.

Is there any good reason why these queries should behave differently?

Attached is an extremely simple patch to allow the backlinks query to return the standard data structure when the query returns an empty dataset. I'll try to track how this can be addressed in the other affected queries.


Version: unspecified
Severity: normal

attachment api_backlinks_empty_dataset.patch ignored as obsolete

Details

Reference
bz11588

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:55 PM
bzimport set Reference to bz11588.
bzimport added a subscriber: Unknown Object (MLST).

cannon.danielc wrote:

Yeah, we should probably standardize these. Setting it as low-priority, though, as I don't think this is anything of particular urgency. Backlinks fixed in r26954. I'll try to get around to looking at the other queries some time (there are a lot of them though!).

Comment on attachment 4236
Allows the backlinks query to return the standard data structure when the query returns an empty dataset.

Marking patch as obsolete 'cause it's been applied already

This would seem to be resolved (checking through they all are the same)

bug 21991 is of a similar nature (how the bad inputs are dealt with - Empty data set, error)