Forum Academy Marketplace Showcase Pricing Features

Distance sorting repeating group

Hey Community,

i am in the final stages of my app so I hope I do not need to bother you any longer :slight_smile:.

I have another thing I do not understand: The sorting algorithm of a repeating group after Distance does not really work for me. What do I do wrong?

In the repeating group I have:

It results in a repeating group like that:

In the right corner I display the distance from the restaurant location to the current users adress. So in theory exactly how it should be sorted. As you can see it is random: Some small numbers are up, some bigger ones in the middle and really small ones at the bottom. The code to calculate the distance looks like that:

Should that not be the exact same numbers after which the repeating group is supposed to sort? What am I missing?

Thanks for your help :wink:

Best regards,

Paul

So the algorithm elastic search uses to sort by address is more accurate than the one we use to compute addresses, so if you go with more than 1 decimal it is very possible that you see what you’re seeing (the earth isn’t flat, isn’t perfectly spherical either…). Do you see very strange results, or it’s about the second number after the comma?

1 Like