Last modified: 2013-02-07 16:03:44 UTC
This behavior is observable on the English Wikipedia. For example, https://en.wikipedia.org/wiki/Brian_King uses the magic word, as: {{DEFAULTSORT:King, Brian}} - it works inconsistently: in https://en.wikipedia.org/wiki/Category:People_educated_at_Sydney_Boys_High_School he is sorted under K. However, for some categories, e.g. https://en.wikipedia.org/wiki/Category:Articles_with_invalid_ISBNs he is sorted under B. The category contains numerous examples of correctly interpreted {{DEFAULTSORT}}s (e.g. https://en.wikipedia.org/wiki/Dodie_Bellamy ) and incorrectly interpreted ones (all the Michaels here: https://en.wikipedia.org/w/index.php?title=Category:Articles_with_invalid_ISBNs&pagefrom=Mi ).
Note: there is a discussion regarding this behavior here: http://en.wikipedia.org/wiki/Help_talk:Category#DEFAULTSORT_inconsistency_.28.3F.29
That's interesting. I wonder if it could possibly be related to that old bug where magic words were not recognized during reparses happening via the job queue (although I believe that was long fixed) [Can't find bug number at the moment]
Hmm, even on fresh parses the sortkey for that cat is wrong - https://en.wikipedia.org/w/api.php?text={{:Brian_King}}&action=parse&prop=categories Also, https://en.wikipedia.org/w/index.php?title=Brian_King&action=raw&templates=expand&ctype=text/css doesn't expand the ISBN is broken template??
Oh, its because its inside a <ref> (Causes the {{Defaultsortkey}} not to be applied, and for that template not to be expanded in the expandtemplates call i listed in comment 3)
Sorry, I updated the bug a little too quickly. It only happens if the {{DEFAULTSORT}} comes after the <references/> list. Minimal test case: category:foo]]%3C/ref%3E%3Creferences/%3E{{DEFAULTSORT:bar}}&action=parse&prop=categories">https://en.wikipedia.org/w/api.php?text=%3Cref%3E[[category:foo]]%3C/ref%3E%3Creferences/%3E{{DEFAULTSORT:bar}}&action=parse&prop=categories (Expected behaviour is for that query to have same output as category:foo]]%3C/ref%3E{{DEFAULTSORT:bar}}%3Creferences/%3E&action=parse&prop=categories">https://en.wikipedia.org/w/api.php?text=%3Cref%3E[[category:foo]]%3C/ref%3E{{DEFAULTSORT:bar}}%3Creferences/%3E&action=parse&prop=categories
Can I get three cheers for bugzilla sucking ;) Minimal test case url: https://en.wikipedia.org/w/api.php?text=%3Cref%3E%5B%5Bcategory:foo%5D%5D%3C/ref%3E%3Creferences/%3E{{DEFAULTSORT:bar}}&action=parse&prop=categories Expected behaviour url: https://en.wikipedia.org/w/api.php?text=%3Cref%3E%5B%5Bcategory:foo%5D%5D%3C/ref%3E{{DEFAULTSORT:bar}}%3Creferences/%3E&action=parse&prop=categories
Unfortunately, it may be a little more complex, or there may be another bug to find. The bug you found the minimal test case for doesn't seem to account for the fact that on some categories, the DEFAULTSORT _is_ taken into account (e.g. Brian King in Category:People_educated_at_Sydney_Boys_High_School ).
(In reply to comment #7) > Unfortunately, it may be a little more complex, or there may be another bug > to > find. The bug you found the minimal test case for doesn't seem to account for > the fact that on some categories, the DEFAULTSORT _is_ taken into account > (e.g. > Brian King in Category:People_educated_at_Sydney_Boys_High_School ). That category is not inside a <ref> tag. So if this was an example article Lorem ipsum dolor sit amet, [[category:Foo]] consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <ref>[[category:Bar]]</ref> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <references/> {{DEFAULTSORT:xyzzy}} Excepteur sint [[category:Baz]] occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Category Foo and Baz would have the sortkey xyzzy, while Bar (being inside a <ref>) would have the page's name as the sortkey. If {{DEFAULTSORT:xyzzy}} was moved before the <references/> tag, then all three would have xyzzy as their sortkey.
I misunderstood what you were saying. Apologies.
(In reply to comment #9) > I misunderstood what you were saying. Apologies. No worries, I was a bit unclear the first time around.
*** This bug has been marked as a duplicate of bug 38435 ***