Getting distances in "near" queries