Answers.Body: <p>What I'm not clear of is if you are asking if you can query for entries that have a matrix field that contains x, or if you just asking if you can search within a matrix field of an entry that has already been returned by a query. </p>
  
  <p>If it is the later, the following solution would work. This isn't a feature of Craft, but a feature of Twig. Thus, implementing it won't save on queries or anything, but it will help you filter the results returned by Craft.</p>
  
  <p>Twig has a feature that allows you to apply a condition in addition to the for loop. It is documented <a href="http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition" rel="nofollow">here</a>.</p>
  
  <pre><code>{% for cta in entry.homeCtas if cta.ctaTitle == "Lorem Ipsum" %}
      &lt;h1&gt;{{ cta.ctaTitle }}&lt;/h1&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-25T02:11:20.497Z
Answers.Text: Thanks, Wes. I should have clarified this further. I _was_ working with the latter situation. I'll give this a shot!
Answers.UserDisplayName: Aaron Bushnell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-25T00:48:58.700Z
Answers.LastActivityDate: 2014-08-25T00:48:58.700Z
Answers.UserDisplayName: Wes Rice
Body: <p>I'm not entirely sure how to search a <em>specific</em> Matrix field for a given bit of content. I can use:</p>
  
  <pre><code>{% for cta in entry.homeCtas.search('"Lorem Ipsum"') %}
      &lt;h1&gt;{{ cta.ctaTitle }}&lt;/h1&gt;
  {% endfor %}
  </code></pre>
  
  <p>to find any Matrix rows with "Lorem Ipsum" (not in a specific field). But when I try something like this:</p>
  
  <pre><code>{% for cta in entry.homeCtas.search('ctaTitle:"Lorem Ipsum"') %}
      &lt;h1&gt;{{ cta.ctaTitle }}&lt;/h1&gt;
  {% endfor %}
  </code></pre>
  
  <p>It returns nothing. Is my field syntax incorrect? Am I missing something obvious?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-24T22:12:47.363Z
Comments.Text: I think this could help: http://craftcms.stackexchange.com/a/2104/125
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-24T22:26:42.020Z
Comments.Text: Hm, I'm not certain that confirms/denies an ability to search a specific field within a Matrix, though. The comment at the end ("You can't use search('fileId:sitelogo'), because that would filter for entries with fileId:sitelogo and not entries with a matrix block fileId:sitelogo.") makes it sound like this user is explaining why the author's original code doesn't work. I don't see anything about if it's possible or not.
Comments.UserDisplayName: Aaron Bushnell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-24T22:33:51.290Z
Comments.Text: There is no such thing as a matrixcriteriamodel. Only type and limit filter is possible (at least that's the only filters documented).
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-25T07:31:24.890Z
Comments.Text: This didn't help, Aaron?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-25T17:30:58.147Z
Comments.Text: Sorry, carlcs. Thanks for clarifying that for me! Hopefully one day Matrix will have this level of support.
Comments.UserDisplayName: Aaron Bushnell
Tags: <matrix><search><filter>
Title: How to search for content in a specific Matrix field?
ThreadText: # How to search for content in a specific Matrix field?
  
  (Asked by: username_0 on 2014-08-24)
  
  I'm not entirely sure how to search a *specific* Matrix field for a given bit of content. I can use:
  
  ```
  {% for cta in entry.homeCtas.search('"Lorem Ipsum"') %}
      <h1>{{ cta.ctaTitle }}</h1>
  {% endfor %}
  
  ```
  
  to find any Matrix rows with "Lorem Ipsum" (not in a specific field). But when I try something like this:
  
  ```
  {% for cta in entry.homeCtas.search('ctaTitle:"Lorem Ipsum"') %}
      <h1>{{ cta.ctaTitle }}</h1>
  {% endfor %}
  
  ```
  
  It returns nothing. Is my field syntax incorrect? Am I missing something obvious?
  
  **Tags:** matrix, search, filter
  
  > **Comments:**
  > **username_1**: I think this could help: http://craftcms.stackexchange.com/a/2104/125  
  > **username_0**: Hm, I'm not certain that confirms/denies an ability to search a specific field within a Matrix, though. The comment at the end ("You can't use search('fileId:sitelogo'), because that would filter for entries with fileId:sitelogo and not entries with a matrix block fileId:sitelogo.") makes it sound like this user is explaining why the author's original code doesn't work. I don't see anything about if it's possible or not.  
  > **username_1**: There is no such thing as a matrixcriteriamodel. Only type and limit filter is possible (at least that's the only filters documented).  
  > **username_1**: This didn't help, username_0?  
  > **username_0**: Sorry, username_1. Thanks for clarifying that for me! Hopefully one day Matrix will have this level of support.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-08-25. Score: 2 | Accepted answer
  
  What I'm not clear of is if you are asking if you can query for entries that have a matrix field that contains x, or if you just asking if you can search within a matrix field of an entry that has already been returned by a query.
  
  If it is the later, the following solution would work. This isn't a feature of Craft, but a feature of Twig. Thus, implementing it won't save on queries or anything, but it will help you filter the results returned by Craft.
  
  Twig has a feature that allows you to apply a condition in addition to the for loop. It is documented [here](http://twig.sensiolabs.org/doc/tags/for.html#adding-a-condition).
  
  ```
  {% for cta in entry.homeCtas if cta.ctaTitle == "Lorem Ipsum" %}
      <h1>{{ cta.ctaTitle }}</h1>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks, Wes. I should have clarified this further. I _was_ working with the latter situation. I'll give this a shot!  
  
  ---
  
  