Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema Pruning