Adding sorting to the criteria search.