Intro

Criteria are the filters for Content and Location Search in "Platform stack", for generic use of API Search see Search Criterions and Sort Clauses

Just like the other search related features: SortClauses and FacetBuilders/Facets, they consists of two parts:

Certain Criteria, like SortClauses, are only supported for LocationSearch, and is missing or has been deprecated from use with ContentSearch because they are location specific and gives unpredictable result when Content has several locations. These can been seen below starting with Location\.

The Criterion represent the value you use in the API, while CriterionHandler deals with the business logic in the background translating the value to something the Search engine can understand.

Common for all Criteria

For how to use each and every Criterion, see list below as it depends on the Value, but in general a Criterion usually only care some of these three concepts:

List of Criteria

The list below reflects Criteria available in eZ\Publish\API\Repository\Values\Content\Query\Criterion namespace (it is also possible to make custom once not listed here):

CriterionConstructor arguments description
Location\Depth operator (IN, EQ, GT, GTE, LT, LTE, BETWEEN), value being the location depth(s) as an integer(s).
Location\IsMainLocation value (Location\IsMainLocation::MAIN, Location\IsMainLocation::NOT_MAIN)
Location\Priority  operator (GT, GTE, LT, LTE, BETWEEN), value being the location priority(s) as an integer(s).
ContentIdvalue being scalar(s) representing the Content id.
ContentTypeGroupId value being scalar(s) representing the ContentTypeGroup id.
ContentTypeId value being scalar(s) representing the ContentType id.
ContentTypeIdentifier  value being string(s) representing the ContentType identifier, example: "article"
DateMetadatatarget (DateMetadata::MODIFIED , DateMetadata::CREATED), operator (IN, EQ, GT, GTE, LT, LTE, BETWEEN), value being integer(s) representing unix timestamp.
Depth
Field

target (FieldDefinition identifier), operator (IN, EQ, GT, GTE, LT, LTE, LIKE, BETWEEN, CONTAINS), value being scalar(s) relevant for the field.

FieldRelation target (FieldDefinition identifier), operator (IN, CONTAINS), value being array of scalars representing Content id of relation.
Use of IN means relation needs to have one of the provided ID's, while CONTAINS implies it needs to have all provide id's.
FullText
LanguageCodevalue being string(s) representing Language Code(s) on the Content (not on Fields), matchAlwaysAvailable as boolean.
LocationId value being scalar(s) representing the Location id.
LocationPriority
LocationRemoteId value being string(s) representing the Location Remote id.
LogicalAndA LogicalOperator that takes array of other Criteria, makes sure all Criteria matches.
LogicalNotA LogicalOperator that takes array of other Criteria, makes sure none of the Criteria matches.
LogicalOrA LogicalOperator that takes array of other Criteria, makes sure one of the Criteria matches.
MapLocationDistance target (FieldDefinition identifier), operator (IN, EQ, GT, GTE, LT, LTE, BETWEEN), distance as float(s), latitude as float, longitude as float.
MatchAllMainly for internal use when no filter or query is provided on Query object.
MatchNoneMainly for internal use by BlockingLimitation.
MoreLikeThis
ObjectStateId value being string(s) representing the Content ObjectState id.
ParentLocationId value being scalar(s) representing the Location Parent id.
RemoteId value being string(s) representing the Content Remote id.
SectionId value being scalar(s) representing the Content Section id.
Subtree value being string(s) representing the Location id.
UserMetadatatarget (UserMetadata::OWNER , UserMetadata::GROUP, UserMetadata::MODIFIER), operator (IN, EQ), value being scalars(s) representing the User or UserGroup id(s).
Visibilityvalue (Visibility::VISIBLE , Visibility::HIDDEN), Note: acts on one of the locations involved meaning when used with with ContentSearch hidden content will be returned if it has other location which is visible. Use LocationSearch to avoid this.