{% set results = search(request_get('term'), {
    'threshold': 1
}).in(['pages.pages', 'posts.posts']).get() %}

{% set count = results.count %}

{% do template.set('meta_description', count ~ (count == 1 ? ' result' : ' results') ~ ' for "' ~ request_get('term') ~ '"') %}

<div id="search">
    <div class="container">
        <div class="content">

            {% if count == 0 %}
            <h3>
                No Results
                <br>
                <small class="text-muted">Sorry, we could not find anything for "{{ request_get('term') }}".</small>
            </h3>
            {% else %}
            <h2>
                Showing {{ count }} result{{ count > 1 ? 's' }} for "{{ request_get('term') }}"
            </h2>
            {% endif %}
            

            {% for result in results %}
            <h3>
                <a href="{{ result.entry.route('view') }}">
                    {{ result.title }}
                    <br>
                    <small class="text-muted">{{ result.description }}</small>
                </a>
            </h3>
            {% endfor %}

        </div>
    </div>
</div>
