Last modified: 2008-11-03 21:42:40 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 T16978, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 14978 - Random Sort for semantic queries
Random Sort for semantic queries
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Markus Krötzsch
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-29 23:51 UTC by Steren
Modified: 2008-11-03 21:42 UTC (History)
1 user (show)

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


Attachments
Random sort (2.76 KB, patch)
2008-07-29 23:51 UTC, Steren
Details

Description Steren 2008-07-29 23:51:28 UTC
Created attachment 5104 [details]
Random sort

I wrote a small patch for SMW. It allows to sort query results randomly.

Just write "|sort=random" in the {{#ask}} params.

It's compatible with other sorting, which means you can sort ascending by one property and then sort randomly by an other property.
example:
{{#ask: [[test::+]][[check::+]]
|? |? test |? check
|sort = test, check
|order = asc, rand
|limit = 3
}}

It uses the MySQL RAND() function [1], which may not be very efficient on a large number of row [2].
I hope this will be useful. Feel free to add this patch to the SMW development repository if you want.

[1] : http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand
[2] : http://forums.mysql.com/read.php?24,163940,163940

Steren
Comment 1 Siebrand Mazeland 2008-08-11 08:12:56 UTC
Assigned to Markus. Added keyword "patch".
Comment 2 Siebrand Mazeland 2008-11-03 21:42:40 UTC
Applied in r43156.

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


Navigation
Links