-
Notifications
You must be signed in to change notification settings - Fork 638
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
[5.x]: Default title field not being indexed for entry types #15025
Comments
Hi, thanks for reaching out. The title field is always indexed, even for the entries inside a matrix field. For example, I have a top-level entry titled “vegetables” with a CKEditor and Matrix fields in it (both have “Use this field’s values as search keywords” off). CKEditor has a nested entry titled “carrots”, and the matrix field has two nested entries titled “broccoli” and “okra”; all 4 keywords are showing in the In the control panel > Entries > All, I can search for “vegetables” and get one entry as a result, but searching for “broccoli” returns zero results. This is expected behaviour as the control panel search will search for the entries in the specified sections, and the nested entries don’t belong to a section. There’s also this discussion, which you might find helpful. It clarifies the opposite of the behaviour you’re describing: #14978. I hope this helps! I’ll close this now, but feel free to reply if you run into any further problems. |
This situation is problematic for the search feature on the front-end in my eyes. The only workaround I've found is to disable the default title field and create a custom title field with the "Use this field’s values as search keywords" checkbox checked. For example, I created a matrix to manage the content of my "about" page. However, I can't get search results for "Christine Tremblay" (because it's using the default title field), while I can get results for "Directrice générale" (because it's a custom field with "Use this field’s values as search keywords" enabled). This discrepancy means that default title fields within Matrix blocks are not behaving as expected in search functionality, leading to incomplete search results. This problem makes the default title field pointless for many user cases IMHO. Replacing it with a custom title field fixes my problem, but I'd rather use the default field because, well, it's already there. Thank you for your time and sorry if I don't get it maybe? |
I was able to reproduce this, and fixed for the next release. Realized there’s a related bug, where entries’ search indexes don’t get updated automatically for nested entries within Matrix fields, when the nested entries are edited directly. That’s fixed as well, but for Craft 5.2+ since the fix was a bit involved (a7d1780). |
Craft 5.1.8 is out with that fix. Thanks again! |
I can confirm the problem is fixed now, after updating Craft to 5.1.8. Right in time to deploy this site in production! |
What happened?
Description
The default title field is being indexed correctly for sections, and I can search and get results appropriately. However, the same default title field is not being indexed when used inside an entry type for a Matrix block (see attached screenshot below for better context).
Steps to reproduce
Expected behavior
All "title" fields should be indexed, no matter where they are used. Ideally, the system should index the title fields within Matrix blocks just as it does for sections. Alternatively, there should be an option to control this indexing behavior with a checkbox, similar to custom fields.
Actual behavior
The default title field within Matrix block entry types is not being indexed, preventing searches from returning results for values in these title fields.
Craft CMS version
5.1.3
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: