Rishabh & Parth 2012 xapian-letor work

Refactoring on which subsequent GSoC work is based.

Also includes implementations of ListNet & ListMLE which have since been discarded due to possible licensing conflicts (this is noted in the source code in these commits).
`Database::get_termfreq()` will return 0 if the term doesn't exist, so it's just unnecessary overhead to check first - just check if `df == 0` below.