Search entries by matrix field I have a matrix inside of which I have 2 fields, 1. dropdown list containing download types and another asset field. I would like to search first by a category and then I would like to further filter them and see if they have downloads of a certain type. 

I would like to avoid a 2 step searching if possible and search articles that belong to certain category that have a certain download type associated with it.

Any idea on how to achieve this?
You could loop through the Matrix field on every entry save using the awesome Preparse plugin, to store the categories an entry contains in a new field.

https://github.com/aelvan/Preparse-Field-Craft

Here’s example code for your Preparse field, it would store strings like firstCategory,thirdCategory,secondCategory.

{%- set categories = [] %}

{%- for block in entry.myMatrixField.type('myRelevantBlockType') %}
    {%- if block.myDropdownField %}
        {%- set categories = categories|merge([ block.myDropdownField.value ]) %}
    {%- endif %}
{%- endfor %}

{{- categories|join(',') -}}


Once you have populated that field for all your entries, you can filter them by a category using this criteria model.

{% set categoryToSearch = 'secondCategory' %}

{% set entries = craft.entries({
    section: 'myEntriesSection',
    search: 'myPreparseFieldHandle:*' ~ categoryToSearch ~ '*',
}) %}


I have to say that I’m not very proud of this solution as it uses search which I usually try to avoid. But I wasn’t able to come up with a better idea.