Add debug output for document rank