Search entries ordered by sections Is it possible to perform a search and have the results grouped/prioritized by sections?

e.g. something like:

craft.entries.section(['sec3', 'sec5', 'sec1']).search(...).limit(6) as page_info, page_entries


I want sec3 entries first, followed by sec5 and sec1 entries.

Note that I want to use the built-in pagination mechanism and would not like to use hacks such as searching tons of entries and manually group the results by sections.
Something like this should get you started, q is the querystring in your results url:

{% set query = craft.request.getParam('q') %}
{% set entries = craft.entries.search(query).level(1).order('score') %}
{% set grouped = entries|group('section') %}

        &lt;h1&gt;Results for &lt;em&gt;&amp;ldquo;{{ query }}&amp;rdquo;&lt;/em&gt;&lt;/h1&gt;

        {% if entries|length %}
        {% for section, entriesInGroup in grouped %}
        &lt;h3&gt;{{ section }}&lt;/h3&gt;
            &lt;ul&gt;
            {% for entry in entriesInGroup %}
                &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
            {% endfor %}
            &lt;/ul&gt;
        {% endfor %}
{% endif %} 


Not sure how pagination fits in here but I'm sure others will chime in.