Last modified: 2011-11-08 11:17:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34208, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32208 - categorymembers return empty subcategories list (cmnamespace=14)
categorymembers return empty subcategories list (cmnamespace=14)
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.18.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-04 17:05 UTC by Pustomytnyk
Modified: 2011-11-08 11:17 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Pustomytnyk 2011-11-04 17:05:34 UTC
For example http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmnamespace=14

return

<?xml version="1.0"?>
<api>
  <query-continue>
    <categorymembers cmcontinue="page|41544f4d4f534349454e4345|30157604" />
  </query-continue>
  <query>
    <categorymembers />
  </query>
</api>
Comment 1 Lupo 2011-11-07 10:03:54 UTC
Confirmed.

With &cmlimit=max, it does return values. Setting cmlimit to 500 works, too, but cmlimit=5 or 50 still returns empty results (with a cmcontinue).

Interestingly, using cmtype=subcat instead of cmnamespace does return some 10 subcategories plus a cmcontinue. Using cmtype + cmlimit=max returns all subcategories.
https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmtype=subcat
https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmtype=subcat&cmlimit=max

Why can't cmnamespace=14 be translated on the fly by the API into cmtype=subcat and be treated the same? (And ditto for cmnamespace=6 -> cmtype=file.)

(To the OP: on cmtype, see http://lists.wikimedia.org/pipermail/mediawiki-api-announce/2011-October/000025.html )
Comment 2 Pustomytnyk 2011-11-07 17:43:06 UTC
Oh, now I see, thanks :)
http://www.mediawiki.org/wiki/API:Categorymembers is outdated
Comment 3 Roan Kattouw 2011-11-08 11:17:59 UTC
This an artefact of the weird way in which cmnamespace works. When using cmnamespace, you may get responses with fewer results than you were expecting, or even zero results. Following the continue value will eventually get you to the results you were looking for. This is weird, but it has to be this way for performance reasons.

Instead of cmnamespace=14, you should use the newer cmtype=subcat, which doesn't have this problem. Similarly, cmtype=file replaces cmnamespace=6.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links