Replaced ts_rank_cd function to ts_rank.