I'm trying to limit my results to a randomized set. So far, I have this query working:
MATCH (n),
RETURN n, rand() as random
ORDER BY random
LIMIT 25
However, when trying to replace LIMIT 25
with a random number, things go wrong, in both of the following two cypher examples:
MATCH (n)
RETURN n, rand() as random, toInt(rand()*25) as randCount
ORDER BY random
LIMIT randCount
In the above, removing LIMIT returns randcount correctly
WITH toInt(rand()*25) as randCount
MATCH (n)
RETURN n, rand() as random
ORDER BY random
LIMIT randCount
My immediate thought is that Cypher doesn't (yet) support using a variable/expression to limit results... Or I'm doing it wrong ;-)