How to paginate search results? What’s the best way to paginate search results?

I was using

{% set query = craft.request.getParam('q') %}


and then

{% paginate craft.entries.search(query).section('…').limit(…).order('…') as entries %}


but the pagination links (paginate.prevUrl and paginate.nextUrl) don’t contain the query.
{{ paginate.nextUrl }}?q={{ query }} did the trick with this setup.