Sorting files in category by size
OpenPublic

Description

Author: meneldur

Description:
Just that: adding the possibility of sorting the files in a category by size. Would be useful on Wikimedia Commons, where some categories include both very huge and smaller pictures, the first ones being more useful for cropping and so on.


Version: unspecified
Severity: enhancement

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz40870.
bzimport created this task.Via LegacyOct 8 2012, 8:40 PM
Reedy added a comment.Via ConduitOct 8 2012, 8:55 PM

I thought this might've been a dupe...

Either way, it's not a nice query

mysql> EXPLAIN SELECT img_name, img_size FROM categorylinks, page, image WHERE cl_from=page_id AND cl_to = 'Astronomy' AND page_title = img_name ORDER BY img_size;
+----+-------------+---------------+--------+---------------------------------+--------------+---------+-----------------------------------+------+-----------------------------------------------------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

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

1SIMPLEcategorylinksrefcl_from,cl_timestamp,cl_sortkeycl_timestamp257const227Using where; Using index; Using temporary; Using filesort
1SIMPLEpageeq_refPRIMARYPRIMARY4commonswiki.categorylinks.cl_from1
1SIMPLEimageeq_refPRIMARYPRIMARY257commonswiki.page.page_title1

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

mysql> EXPLAIN SELECT img_name, img_size FROM categorylinks FORCE INDEX (cl_from), page, image WHERE cl_from=page_id AND cl_to = 'Astronomy' AND page_title = img_name ORDER BY img_size;
+----+-------------+---------------+--------+---------------+------------+---------+--------------------------------+----------+----------------------------------------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

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

1SIMPLEpageindexPRIMARYname_title261NULL19081712Using index; Using temporary; Using filesort
1SIMPLEimageeq_refPRIMARYPRIMARY257commonswiki.page.page_title1
1SIMPLEcategorylinkseq_refcl_fromcl_from261commonswiki.page.page_id,const1Using where; Using index

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

http://p.defau.lt/?c8nPdSZVr7MLORs00CQB9w

Dereckson added a comment.Via ConduitOct 8 2012, 9:10 PM

Confirming bug as this is a valid feature request.

Reedy, I can't find a dupe bug. The only sorting feature requests close to this concern search results, like bug 16327 or bug 21139.

I'm also adding a 'design' keyword as we need also some UI input to know where the sort links should be added in the category page, in addition to a performance solution.

Bawolff added a comment.Via ConduitOct 9 2012, 4:28 PM

Could possibly be done with some sort of extension that adds file size to the beginning of the category sortkey (In combination with support for multiple sorting collations)

Aklapper added a project: Commons.Via WebTue, Mar 10, 4:45 PM
Steinsplitter moved this task to Backlog on the Commons workboard.Via WebWed, Mar 11, 12:55 PM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.