added distance calculation from location

This commit is contained in:
2024-06-05 12:09:17 +02:00
parent ee65a2cf60
commit 5e6e5492d9

View File

@@ -51,7 +51,10 @@ public class Routes {
posts posts
WHERE WHERE
deleted IS NULL deleted IS NULL
AND sqrt(power(postlocation[0] - (?), 2) + power(postlocation[1] - (?), 2)) <= 10 AND AND earth_distance(
ll_to_earth(posts.postlocation[0], posts.postlocation[1]),
ll_to_earth((?), (?))
) <= 10000
AND posts.id NOT IN (SELECT child FROM comments) AND posts.id NOT IN (SELECT child FROM comments)
UNION UNION
SELECT SELECT