Answers.Body: <p>In this specific case, yes. You can filter your entry query by whether a specific matrix field has at least one block like so:</p>
  
  <pre><code>{% set query = craft.entries({
      section: 'blog',
      myMatrixField: ':notempty:',
      limit: 10
  }) %}
  </code></pre>
  
  <p>or for fields that have 0 matrix blocks in the specific field:</p>
  
  <pre><code>{% set query = craft.entries({
      section: 'blog',
      myMatrixField: ':empty:',
      limit: 10
  }) %}
  </code></pre>
  
  <p>However these are the <em>only</em> two values available for this specific field type. You cannot, for example, search for entries with 3 or more blocks.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-14T21:30:37.207Z
Answers.LastActivityDate: 2019-10-14T21:30:37.207Z
Answers.UserDisplayName: nicholasthompson
Body: <p>I would like to get entries if a matrix field is used. Something like this:</p>
  
  <pre><code>{% set query = craft.entries()
      .section('blog')
      .search('myMatrixField|length')
      .limit(10)
   %}
  </code></pre>
  
Tags: <craft3><matrix><query>
Title: In entries query, is there a way to check if matrix block is used?
ThreadText: # In entries query, is there a way to check if matrix block is used?
  
  (Asked by: username_0 on 2019-10-14)
  
  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)
   %}
  
  ```
  
  **Tags:** craft3, matrix, query
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-14. Score: 2 | Accepted answer
  
  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.
  
  
  ---
  
  