-
-
Notifications
You must be signed in to change notification settings - Fork 597
Description
Bug description
If I use the "select" or "typeahead" UI Mode for an Entry Field, then custom indexes don't seem to be consulted when selecting entries. Note that custom indexes are consulted when using the "stack" UI Mode.
This is probably a limitation of the kind of UI element being used for "select" and "typeahead" presentations, both of which seem to use variations of a dropdown select field. These usually only allow selection by the text shown in the field, which seems to be the "title" field.
It would be great if the custom indexes would work, or if, alternatively, a way were provided to define fields to be used for the text of these select fields so that they could be more flexible than simple titles.
At a minimum, it would help to have a warning on the UI Mode option that lets users know that only titles will be shown for anything other than "stack" presentations.
How to reproduce
For example, in my case I have Courses that are linked from Student Projects.
In /content/collections/courses.yaml I have...
search_index: coursesTo keep this simple, in /config/statamic/search.php I am just trying a transform of the title field
'courses' => [
'driver' => 'local',
'searchables' => 'collection:courses',
'fields' => ['title'],
'transformers' => [
'title' => function ($value, $searchable) {
if ($course = $searchable->value('course')) {
$value .= ' ' . $course['title'] . ' ' . $course['identifier'];
}
return $value;
},
],
],And, of course, I have done php please search:update courses to update the index.
But still, when I type one of the identifiers into the a course entry field in a related student projects entry, I get no hits, it just appears to search the titles that are visible in the dropdown.

However, in the list of course entries, I think this search is working, since I can now get hits from text that is not in the course title or slug.

I'd be happy to do something similar to the index transform or to create an alternative calculated field to be used in the select dropdown, but I don't see any way to do that.
Logs
No response
Environment
Environment
Application Name: Tensegrities
Laravel Version: 11.36.1
PHP Version: 8.3.15
Composer Version: 2.8.3
Environment: local
Debug Mode: OFF
URL: mary.test
Maintenance Mode: OFF
Timezone: America/Chicago
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file
Statamic
Addons: 6
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.45.0 Solo
Statamic Addons
alt-design/alt-redirect: 1.3.3
heidkaemper/statamic-toolbar: 1.3.0
statamic/importer: 1.6.0
statamic/ssg: 3.1.0
stillat/relationships: 2.2.1
trendyminds/statamic-palette: 1.2.1Installation
Fresh statamic/statamic site via CLI
Additional details
No response