<p>Please take a look at the <a href="https://docs.craftcms.com/v2/searching.html#templating" rel="nofollow noreferrer">docs</a> there are so many examples how to search here at stack exchange and it's well explained in the docs. I posted the same answer multiple times within the last days </p>

<pre><code>entry.matrixField.search("mykeyword").all()
</code></pre>

<p>As I already said a few times too "looping through queries is still deprecated". Please fetch your results with <code>.all()</code> or <code>.one()</code>. There is no reason to fill your logs with deprecated warnings - you won't have any benefits </p>

CC BY-SA 4.0
2018-05-12T10:07:38.900Z
My apologies, I did not seem to get it and I looked through the docs, thankfully good peeps like you are here to help out.  I spend a ton of time trying to get the answer before I ever post it on here.
Vin
CC BY-SA 4.0
2018-05-12T11:13:35.277Z
Were you able to make it work now?
Robin Schambach
CC BY-SA 4.0
2018-05-12T19:02:39.497Z
Sort of.  What I really need and would be epic is to get the matching done in the craft.entries tag.  I am 90% finished with my project and being so close I am so far away.  The solution you provided elsewhere I did not realize did not work as I expected.

{% set entries = craft.entries.section('flightcompany').relatedTo('and',
    { targetElement: models, field: 'partsModels.model' },
    { targetElement: parts, field: 'partsModels.part' }
) %}

https://craftcms.stackexchange.com/questions/26107/combining-multiple-relation/26108#26108
Vin
CC BY-SA 4.0
2018-05-12T19:08:20.843Z
What do you mean by `craft.entries` tag? `craft.entries` returns nearly the same type of object like `entry.matrixField` you can use the same syntax and the same parameters since both are `ElementQueries`. Maybe you should learn to provide proper feedback. My query will return all elements that contains `mykeyword`
Robin Schambach
CC BY-SA 4.0
2018-05-12T21:38:06.913Z
Meaning the order in which I call the tags.  I have 80,000+ records, so looping through each entry and each entry has 10+ matrix records, in those records is 1 table 2 category fields. The table field can have 10-20 records each as text.  So it's pulling in the records from my main records in entries which there are 600+ of those.  So I am having to grab the main record and loop through each looking for specific records and writing conditionals to get only records meeting those conditions.
Vin
CC BY-SA 4.0
2018-05-12T21:48:48.013Z
Then you should apply the correct filters for your entries instead of looping through them. But that was not your question
Robin Schambach
CC BY-SA 4.0
2018-05-12T22:03:20.213Z
Well I guess I need that then, I don't know, I am at your mercy Robin :) . Can you show me what the correct filter would be...please.
Vin
CC BY-SA 4.0
2018-05-12T09:59:11.800Z
2018-05-12T09:59:11.800Z
Robin Schambach
<p>Trying to search through a Matrix field, currently I am using conditionals to accomplish this, but if it's faster would like to limit the results to only what I need.</p>

<pre><code>{% for row in entry.matrixField.search(matrixChild1:"mykeyword") %}

{% set getResults = row.matrixChild1.one.slug %}

{% endfor %}
</code></pre>

<p>I could not find much on this, I know a search() parametered can be used in Matrix but after all my trying still nothing.  Hopefully it's possible?</p>

<matrix><craft3><search>
Search Through Matrix Field
# Search Through Matrix Field

(Asked by: username_0 on 2018-05-12)

Trying to search through a Matrix field, currently I am using conditionals to accomplish this, but if it's faster would like to limit the results to only what I need.
{% for row in entry.matrixField.search(matrixChild1:"mykeyword") %}

{% set getResults = row.matrixChild1.one.slug %}

{% endfor %}

I could not find much on this, I know a search() parametered can be used in Matrix but after all my trying still nothing.  Hopefully it's possible?

**Tags:** matrix, craft3, search

---

## 1 answers

### Answer by username_1 on 2018-05-12. Score: 2

Please take a look at the docs there are so many examples how to search here at stack exchange and it's well explained in the docs. I posted the same answer multiple times within the last days 
entry.matrixField.search("mykeyword").all()

As I already said a few times too "looping through queries is still deprecated". Please fetch your results with .all() or .one(). There is no reason to fill your logs with deprecated warnings - you won't have any benefits

> **Comments:**
> **username_0**: My apologies, I did not seem to get it and I looked through the docs, thankfully good peeps like you are here to help out.  I spend a ton of time trying to get the answer before I ever post it on here.  
> **username_1**: Were you able to make it work now?  
> **username_0**: Sort of.  What I really need and would be epic is to get the matching done in the craft.entries tag.  I am 90% finished with my project and being so close I am so far away.  The solution you provided elsewhere I did not realize did not work as I expected.  {% set entries = craft.entries.section('flightcompany').relatedTo('and',     { targetElement: models, field: 'partsModels.model' },     { targetElement: parts, field: 'partsModels.part' } ) %}  https://craftcms.stackexchange.com/questions/26107/combining-multiple-relation/26108#26108  
> **username_1**: What do you mean by `craft.entries` tag? `craft.entries` returns nearly the same type of object like `entry.matrixField` you can use the same syntax and the same parameters since both are `ElementQueries`. Maybe you should learn to provide proper feedback. My query will return all elements that contains `mykeyword`  
> **username_0**: Meaning the order in which I call the tags.  I have 80,000+ records, so looping through each entry and each entry has 10+ matrix records, in those records is 1 table 2 category fields. The table field can have 10-20 records each as text.  So it's pulling in the records from my main records in entries which there are 600+ of those.  So I am having to grab the main record and loop through each looking for specific records and writing conditionals to get only records meeting those conditions.  
> **username_1**: Then you should apply the correct filters for your entries instead of looping through them. But that was not your question  
> **username_0**: Well I guess I need that then, I don't know, I am at your mercy Robin :) . Can you show me what the correct filter would be...please.  

---

