1. A method for learning ranking functions to determine the ranking of one or more content items that are responsive to a query, the method comprising: generating one or more training sets comprising one or more content item-query pairs; determining one or more contradicting pairs in a given training set; formulating an optimization function to minimize the number of contradicting pairs in the training set; modifying the optimization function by incorporating a grade difference between one or more content items corresponding to the query in the training set; applying the optimization function to each query in the training set; determining a ranking function based on the application of regression trees on the one or more queries of the training set minimized by the optimization function; and storing the ranking function for application to content item-query pairs not contained in the one or more training sets.