Skip to content

Search reference

Search Criteria are filters for Content and Location Search.

Criteria can take some of the following arguments:

  • target - when the Criterion supports targeting a specific Field, example: FieldDefinition or Metadata identifier
  • value - the value(s) to filter on, typically a scalar or array of scalars
  • operator - constants on eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator: IN, EQ, GT, GTE, LT, LTE, LIKE, BETWEEN, CONTAINS. Most Criteria do not expose this and select EQ or IN depending on whether the value is scalar or an array. IN and BETWEEN always act on an array of values, while the other operators act on single scalar value
  • valueData - additional value data, required by some Criteria, for instance MapLocationDistance

Support and capabilities of individual Criteria can depend on the search engine.

In the Legacy search engine, the field index/sort key column is limited to 255 characters by design. Due to this storage limitation, searching content using the eZ Country Field Type or Keyword when there are multiple values selected may not return all the expected results.

Search Criteria

Search Criterion Search based on Search type
Ancestor Whether the Content item is an ancestor of the provided Location Content and Location
ContentId Content item's ID Content and Location
ContentTypeGroupId ID of the Content item's Content Type group Content and Location
ContentTypeId ID of the Content item's Content Type Content and Location
ContentTypeIdentifier Identifier of the Content item's Content Type Content and Location
DateMetadata The date when content was created or last modified Content and Location
Depth Location depth in the Content tree Location only
Field Content of one of Content item's Fields Content and Location
FieldRelation Content items the content in question has Relations to Content and Location
FullText Full text content of a Content item's Fields Content and Location
IsFieldEmpty Whether a specified Field of a Content item is empty or not Content and Location
IsMainLocation Whether a Location is the main Location of a Content item Location only
LanguageCode Whether a Content item is translated into the selected language Content and Location
LocationId Location ID Content and Location
LocationRemoteId Location remote ID Content and Location
MapLocationDistance Distance between the location contained in a MapLocation Field and the provided coordinates Content and Location
MatchAll Returns all search results Content and Location
MatchNone Returns no search results Content and Location
ObjectStateId Object State ID Content and Location
ParentLocationId Location ID of a Content item's parent Content and Location
Priority Location priority Location only
RemoteId Remote content ID Content and Location
SectionId The Section content is assigned to Content and Location
Subtree Location subtree Content and Location
UserMetadata The creator or modifier of a Content item Content and Location
Visibility Whether the Content item is visible or not Content and Location

Logical operators

Search Criterion Search based on Search type
LogicalAnd Implements a logical AND Criterion. It matches if ALL of the provided Criteria match. Content and Location
LogicalNot Implements a logical NOT Criterion. It matches if the provided Criterion doesn't match. Content and Location
LogicalOr Implements a logical OR Criterion. It matches if at least one of the provided Criteria matches. Content and Location