Custom Search Fields - Update docuemtatio #17872
Replies: 1 comment
-
|
Hi, maybe part of the confusion here is that you are referring to two different types of params.
It’s possible to target custom field keywords specifically from that, by prefixing your search term with Separately, custom fields also provide support for their own direct element query params, e.g.
For example, see the Querying Elements with Dropdown Fields section on the Dropdown field type’s page.
Depending on the field type, that could be correct. If it’s a Dropdown field and one of the option values is
What type of field is |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Please update your documentation:
https://craftcms.com/docs/5.x/system/searching.html
I waste so much time on this every few months. It so easy, yet so frustrating. Somewhere in an old support email from you, or project, I have the answer. But it's impossible to find.
I just need to query by custom fields or search by custom fields. And sometimes a wildcard match - that it.
if I have a custom field called whatever, how can I do this?
{% set entry = craft.entries() .section('myentries') .whatever('abc) .one() %}I think technically that is documented (https://craftcms.com/docs/5.x/development/element-queries.html#types--parameters - ie .paintColor('silver') but it does not work for me.
or this?
{% set entry = craft.entries() .section('myentries') .whatever('*' ~ value ~ '*') .one() %}or this?
{% set entry = craft.entries() .section('myentries') .search('whatever:*' ~ value ~ '*') .one() %}Yes, search indexing is enabled for field and everything is resaved.
etc. There is some custom field thing we have to do in twig, but it's un-documented.
I would love for you to not answer her e- because it will get lost. But update your documentation - please. I wasted a half day on this already.
I'm just bypassing search entirely now, query all entries, and manually matching. Exhausted - thanks!
Beta Was this translation helpful? Give feedback.
All reactions