PR: Added support for sort_mode `avg` for sorting by geo_distance.

Relates to #2962