-
-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom indexes not used by all entry fields #11308
Comments
By the way, I found a work-around, which is to make |
I would expect But Can you show the configuration of that field? |
@jasonvarga, here is another example... This is the definition of the entry field: handle: course_entry
field:
max_items: 1
collections:
- courses
type: entries
display: Course
search_index: courses
width: 50
mode: typeahead Here is what it looks like as I type a word: And here is what a search for the same word looks like when I look at the collection in question: So, yes, the entry field is set up with |
I tried to replicate this locally and found that typeahead fields definitely do trigger the search index as expected. Are you able to create a repository showing the issue so that it can be investigated further? |
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...To keep this simple, in
/config/statamic/search.php
I am just trying a transform of thetitle
fieldAnd, of course, I have done
![Screenshot 2025-01-02 at 1 53 04 PM](https://private-user-images.githubusercontent.com/604967/399798914-4cb7dfd2-8bf9-4f92-ab18-4d34f3e706ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDAwMDQzMzcsIm5iZiI6MTc0MDAwNDAzNywicGF0aCI6Ii82MDQ5NjcvMzk5Nzk4O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WQ5NmZhNDE4NmRhYmZiZDY5MzdmNmFlZmVhM2JiZGU5YWM4YmFkODUxNzBmNGRmMWNjZGNmOTYyN2UxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.yFTFlT3GB-t65hneatmf5c1thl715Wq_sQ7GeFKrXRM)
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
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
The text was updated successfully, but these errors were encountered: