Optimizing Compound Retrieval Systems