As a follow-up to a previous livestream where we talked about how to created custom field indexes in Craft 4, Andrew details how you can create functional indexes for custom fields in Craft 5 now that the content table is gone and field data is stored in JSON in the element_entries table.
Streamed on May 16, 2024
{% 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 %}
#}
```
Some stuff to help you along during the lesson: