Enhancing Retrieval Systems: Compound Framework Optimization