Random Sort for semantic queries
Closed, ResolvedPublic

Description

Author: steren.giannini

Description:
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


Version: unspecified
Severity: enhancement

Attached: RandomSort.diff

bzimport set Reference to bz14978.
bzimport created this task.Via LegacyJul 29 2008, 11:51 PM
siebrand added a comment.Via ConduitAug 11 2008, 8:12 AM

Assigned to Markus. Added keyword "patch".

siebrand added a comment.Via ConduitNov 3 2008, 9:42 PM

Applied in r43156.

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.