1

I have a search form on a website to search through all the entries of the website and return the entries that match the search query.

But the search query is also used on asset fields within an entry. Which for the companies channel results in many entries found when you search on the word: logo.

I like to know if there is a way to search through all the fields of an entry, but without looking through the asset field type?

So for the companies example, I only want to find entries that match the word: logo. When that word is in the content text, and not in an asset name/title.

My code now is this, but it returns the asset fieldtype result as well:

{% set entries = craft.entries({ section: 'not comments' }).search( query ).order('score') %}
1

As suggested in this stack post, you could specify each field individually. I haven't done this with fields, but often do so with sections and entry types in global site searches. It is kind of annoying, but I'm not sure there is a way to do this using Craft's API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.