Similar Items: Beyond Semantic Relevance: Counterfactual Risk Minimization for Robust Retrieval-Augmented Generation