Last modified: 2012-12-30 20:58:36 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 T42870, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40870 - Sorting files in category by size
Sorting files in category by size
Status: NEW
Product: MediaWiki
Classification: Unclassified
Categories (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: design, performance
Depends on:
Blocks: commons
  Show dependency treegraph
 
Reported: 2012-10-08 20:40 UTC by Julien M.
Modified: 2012-12-30 20:58 UTC (History)
2 users (show)

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


Attachments

Description Julien M. 2012-10-08 20:40:53 UTC
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.
Comment 1 Sam Reed (reedy) 2012-10-08 20:55:49 UTC
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;
+----+-------------+---------------+--------+---------------------------------+--------------+---------+-----------------------------------+------+-----------------------------------------------------------+
| id | select_type | table         | type   | possible_keys                   | key          | key_len | ref                               | rows | Extra                                                     |
+----+-------------+---------------+--------+---------------------------------+--------------+---------+-----------------------------------+------+-----------------------------------------------------------+
|  1 | SIMPLE      | categorylinks | ref    | cl_from,cl_timestamp,cl_sortkey | cl_timestamp | 257     | const                             |  227 | Using where; Using index; Using temporary; Using filesort |
|  1 | SIMPLE      | page          | eq_ref | PRIMARY                         | PRIMARY      | 4       | commonswiki.categorylinks.cl_from |    1 |                                                           |
|  1 | SIMPLE      | image         | eq_ref | PRIMARY                         | PRIMARY      | 257     | commonswiki.page.page_title       |    1 |                                                           |
+----+-------------+---------------+--------+---------------------------------+--------------+---------+-----------------------------------+------+-----------------------------------------------------------+
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;
+----+-------------+---------------+--------+---------------+------------+---------+--------------------------------+----------+----------------------------------------------+
| id | select_type | table         | type   | possible_keys | key        | key_len | ref                            | rows     | Extra                                        |
+----+-------------+---------------+--------+---------------+------------+---------+--------------------------------+----------+----------------------------------------------+
|  1 | SIMPLE      | page          | index  | PRIMARY       | name_title | 261     | NULL                           | 19081712 | Using index; Using temporary; Using filesort |
|  1 | SIMPLE      | image         | eq_ref | PRIMARY       | PRIMARY    | 257     | commonswiki.page.page_title    |        1 |                                              |
|  1 | SIMPLE      | categorylinks | eq_ref | cl_from       | cl_from    | 261     | commonswiki.page.page_id,const |        1 | Using where; Using index                     |
+----+-------------+---------------+--------+---------------+------------+---------+--------------------------------+----------+----------------------------------------------+
3 rows in set (0.00 sec)


http://p.defau.lt/?c8nPdSZVr7MLORs00CQB9w
Comment 2 Dereckson 2012-10-08 21:10:33 UTC
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.
Comment 3 Bawolff (Brian Wolff) 2012-10-09 16:28:41 UTC
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)

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


Navigation
Links