get queries with distance and pagination