Open forewarned opened 5 years ago
Thank you for bringing this to our attention - we will take a look.
Hi @forewarned I looked a bit into your report.
the sort()
function is defaulting to sort(reverse=true)
when used on numbers. This is because we typically are interested in the highest number of occurrences when using the sort function (keep in mind that the natural sorting of numbers would start with the lowest number first.)
So to get the reverse of the default you have to sort(reverse=false)
This can be a bit confusing (it was for me at least).
Perhaps a more intuitive way would be to use the order
parameter
e.g. sort(order=ascending)
or sort(order=descending)
Let me know if this works for you.
Thank you for the clarification. The word "reverse" tells me to reverse or flip the default order, hence the confusion. If looking at it from a purely technical implementation standpoint, then I agree it makes sense to keep it like this. I think it is not intuitive to the person though. However, I wouldn't change the behavior unless more people run into the same confusion I did.
Can the query-function documentation be updated at least? It doesn't make it clear the order is different between strings and numbers. There wording on the order parameter description is "descending is default", which isn't true as ascending is default for strings, correct?
The "reverse" parameter in the query function "sort" does not reverse-sort the results. The results returned are the same as if the reverse parameter was not present.