Ordering and index search foundation code