1

I would like to get entries if a matrix field is used. Something like this:

{% set query = craft.entries()
    .section('blog')
    .search('myMatrixField|length')
    .limit(10)
 %}
2

In this specific case, yes. You can filter your entry query by whether a specific matrix field has at least one block like so:

{% set query = craft.entries({
    section: 'blog',
    myMatrixField: ':notempty:',
    limit: 10
}) %}

or for fields that have 0 matrix blocks in the specific field:

{% set query = craft.entries({
    section: 'blog',
    myMatrixField: ':empty:',
    limit: 10
}) %}

However these are the only two values available for this specific field type. You cannot, for example, search for entries with 3 or more blocks.

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.