convert asc/desc into 1/-1 for sort