CORE-5812: fixed a problem with the sort direction query parameter not being compared properly