Page MenuHomePhabricator

categorymembers sortkey in the api contains gibberish
Closed, InvalidPublic

Description

Output from the api:

<?xml version="1.0"?>
<api>

<query>
  <categorymembers>
    <cm pageid="6221951" ns="14" title="Category:Windmills in the Netherlands by century" sortkey="2043454e545552590a57494e444d494c4c5320494e20544845204e45544845524c414e44532042592043454e54555259" timestamp="2009-03-13T16:44:53Z" />
    <cm pageid="17450828" ns="14" title="Category:Demolished windmills in the Netherlands" sortkey="2044454d4f4c49534845442057494e444d494c4c530a44454d4f4c49534845442057494e444d494c4c5320494e20544845204e45544845524c414e4453" timestamp="2011-11-23T04:14:02Z" />
    <cm pageid="6185506" ns="14" title="Category:Windmills in the Netherlands by type" sortkey="20545950450a57494e444d494c4c5320494e20544845204e45544845524c414e44532042592054595045" timestamp="2009-03-09T20:38:57Z" />
    <cm pageid="2631136" ns="14" title="Category:Windmills in Drenthe" sortkey="4452454e5448450a57494e444d494c4c5320494e204452454e544845" timestamp="2009-02-06T12:12:46Z" />
    <cm pageid="2647481" ns="14" title="Category:Windmills in Friesland" sortkey="46524945534c414e440a57494e444d494c4c5320494e2046524945534c414e44" timestamp="2009-02-06T12:13:41Z" />
    <cm pageid="2647401" ns="14" title="Category:Windmills in Gelderland" sortkey="47454c4445524c414e440a57494e444d494c4c5320494e2047454c4445524c414e44" timestamp="2009-02-06T12:13:59Z" />
    <cm pageid="5982816" ns="14" title="Category:Windmills in Groningen (province)" sortkey="47524f4e494e47454e0a57494e444d494c4c5320494e2047524f4e494e47454e202850524f56494e434529" timestamp="2009-02-18T07:51:37Z" />
    <cm pageid="7748299" ns="14" title="Category:Windmills in Limburg (Netherlands)" sortkey="4c494d4255524720284e45544845524c414e4453290a57494e444d494c4c5320494e204c494d4255524720284e45544845524c414e445329" timestamp="2009-09-06T16:52:00Z" />
    <cm pageid="2630802" ns="14" title="Category:Windmills in North Brabant" sortkey="4e4f5254482042524142414e540a57494e444d494c4c5320494e204e4f5254482042524142414e54" timestamp="2009-02-06T12:14:57Z" />
    <cm pageid="2632000" ns="14" title="Category:Windmills in North Holland" sortkey="4e4f52544820484f4c4c414e440a57494e444d494c4c5320494e204e4f52544820484f4c4c414e44" timestamp="2009-02-06T12:15:19Z" />
  </categorymembers>
</query>
<query-continue>
  <categorymembers cmcontinue="subcat|4f564552494a5353454c0a57494e444d494c4c5320494e204f564552494a5353454c|2647489" />
</query-continue>

</api>

Expected:

mysql> SELECT cl_sortkey_prefix FROM categorylinks WHERE cl_to='Windmills_in_the_Netherlands' LIMIT 10;
+-----------------------+

cl_sortkey_prefix

+-----------------------+

Century
Demolished windmills
Type
Drenthe
Friesland
Gelderland
Groningen
Limburg (Netherlands)
North Brabant
North Holland

+-----------------------+
10 rows in set (0.00 sec)

I know this used to work because my intersection bot uses this information to sort out some categories. This is now broken.


Version: 1.21.x
Severity: normal
URL: https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Windmills_in_the_Netherlands&cmprop=title|ids|sortkey|timestamp

Details

Reference
bz44326

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:38 AM
bzimport set Reference to bz44326.
bzimport added a subscriber: Unknown Object (MLST).

This change was announced in April 2011. See the announcement at http://lists.wikimedia.org/pipermail/mediawiki-api-announce/2011-April/000020.html

If you're just sorting, the "gibberish" will sort correctly. If you need the human-readable sortkey for some reason, you can get it by using cmprop=sortkeyprefix (and then using the title if empty) rather than cmprop=sortkey, e.g. https://commons.wikimedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Windmills_in_the_Netherlands&cmprop=title|ids|sortkeyprefix|timestamp