LLM-QE: Improving Query Expansion by Aligning Large Language Models with Ranking Preferences