How to search for a specific field using getCriteria()? I'm looking at making a plugin and need to search news entries.
I can use:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'news';
$find = $criteria-&gt;find();


However, I want to add a criteria where I search a specific field, for example: fieldabc = 'zyx'

What is the correct syntax for this?

Thanks!
As per the (new) "Working with Elements" guide from the docs, it works the same as from your templates.


  The actual list of available parameters depends on the element type. They are identical to the parameters available to your templates.


So this template example:

{% craft.entries.section('news').myPlaintextField('xyz').myLightswitchField(1) %}


Works from your plugin like so:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section            = 'news';
$criteria-&gt;myPlaintextField   = 'xyz';
$criteria-&gt;myLightswitchField = 1;


Using custom field parameters is a fast and reliable solution if you are looking for EXACT matches. I would only use the search parameter if there's no other solution.