Direct Optimization of Ranking Measures