Making generate_rank as generic as possible to consider all kind of ranking metrics.