Simetrical schreef:
There are various methods that have been discussed to deal with this. We could, for instance, include a null or other low-sorting ASCIIbetical character in the sort keys of subcategories. That would be the quick and ugly way, and would work okay, but would still possibly not work as expected -- subcategories would still be paged with everything else, just always on the first page, and not necessarily even that if someone used some really weird sort keys.
Arguably, a better way would be to have a separate subcategorylinks table, keep category articles' category inclusions out of the categorylinks table, and page them totally separately. This is harder and also fragments very similar info into separate tables. A similar solution would be to add a one-bit field (CHAR(0) NULL?! :D) to categorylinks, index it, and use that to indicate whether cl_from is a category or not. This bloats indexes a bit.
Although we may want to add cl_is_category, retrieving subcategories only is already possible with the current schema:
SELECT whatever FROM categorylinks JOIN page ON page_id=cl_from AND page_namespace=14 WHERE cl_title='Foo' AND cl_namespace=0;
No idea how efficient this query is, maybe it's evil and uses 57 filesorts, who knows ;)
Roan Kattouw (Catrope)