Make rankings query function more generic by using record type enum.