From Prompting to Alignment: A Generative Framework for Query Recommendation