Implemented top-k query with term frequency.