Understanding how KNearestSearch works