Developers/Conditions for searching

Conditions for searching
The searchItems method of all managers requires a criteria object whose conditions are used to limit the result set only to the necessary entries. The conditions are in an abstract notation which is translated to the real notation of the underlying storage (e.g. SQL for databases) before sending the query to the storage manager (the database server in case of SQL).

There are two types of operators available, one for comparing items against values and one for combining one or more terms (compare or further combine terms).

List of combination operators:
 * "&&": term1 AND term2 (AND term3)*
 * "||": term1 OR term2 (OR term3)*
 * "!": NOT term (allows only one term)

List of comparison operators:
 * "==": item EQUAL value (or list of values)
 * "!=": item NOT EQUAL value (or list of values)
 * "~=": item LIKE value
 * ">=": item GREATER OR EQUAL value
 * "<=": item SMALLER OR EQUAL value
 * ">": item GREATER value
 * "<": item SMALLER value

With these operators, you can build conditions of any complexity, e.g.

This code block would search for all products whose ID is in the list of IDs and which has a modification time later than begin of 2012. The result would also be limited by the default conditions (which are filtering by "product.status", "product.datestart" and "product.dateend") because of the "true" parameter in the createSearch call and the $search->getConditions as first expression.