Can’t believe this is the first time I’ve had to do this, but I need to search a field inside a matrix and I can’t find any documentation on this. Craft 2 if that matters. I had hoped something like


would work but doesn’t seem to. Anyone help me out?

1 Answer 1


As far as I know (please correct me if I missed something) you can only search for the entire matrix by matrixField:value and not certain fields within your matrix since the table searchindexes only contains the id of the matrix field itself, not the id of the field inside the matrix.

However: you could create a Query from your ElementCriteriaModel in PHP via

$command = craft()->elements->buildElementsQuery($criteria);

Join your matrixblock table as well as your matrixblock content table

$command->join("your matrixTable", "matrixTable.ownerId = elements.id");
$command->join("your matrixContentTable", "matrixContentTable.elementId = matrixTable.id");

And search for your field with a where

$command->andWhere('MyAwesomeField LIKE %whatever%');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.