Added the distance parameter on query and fixed the type error