Improving Performance with Custom Field Functional Indexes in Craft 5

Learn how to use a Craft content migration to create a functional index for a custom field in Craft CMS version 5.

Streamed on May 16, 2024

Craft 5

Performance


    {% set ryansKnownAliases = [
        'Ryan Leffler',
        'Ben Herman',
        'Mathew Rodriguez',
        'Brandon Keeling',
        'Mallory Welch',
    ] %}
    {% for ryansKnownAlias in ryansKnownAliases %}
        {% set entries = craft.entries()
            .section('demo')
            .demoData(ryansKnownAlias)
            .all() %}
        {% for entry in entries %}
            <p>{{ entry.demoData }}</p>
        {% endfor %}
    {% endfor %}

    {#
    {% set queryParam = ['or'] | merge(ryansKnownAliases) %}
    {% set entries = craft.entries()
        .section('demo')
        .demoData(queryParam)
        .all() %}
    {% for entry in entries %}
        <p>{{ entry.demoData }}</p>
    {% endfor %}
    #}