Implements sorting on joined index