MB-7628 fix sort phase order

Change-Id: I59a6db217e4e573ad18c4ca9b746b5df31008188
Reviewed-on: http://review.couchbase.org/24288
Reviewed-by: Thuan Nguyen <soccon@gmail.com>
Tested-by: Thuan Nguyen <soccon@gmail.com>