How to add a random number to ranking weights
I need to add a random number to the ranking weights for each item in a search.
Something like $qre: expression: 'rand(0-600)'
The ExprTk doesn't seem to have a random function, it looks like it depends on the code it is used with.
Did I miss something, or is there another method to do this?
I must admit, it's the first time I see someone requesting for the result ordering to have a random factor. Out of sheer curiosity, what is the use case?
As for a solution, you can inject those
$qre expressions in JS when building the query; I'd generate one with a random number there and send it over to the server. Indeed we don't provide any server-side way to introduce randomness, but it wouldn't be hard to do. It's just that we haven't any use case for it… unless you can provide us with a perfect one :)