Skip to main content
Version: 2026.1

Search Modifiers

Search modifiers filter, sort, and aggregate search results by altering the underlying query. Add them via the addModifier() method:

$search->addModifier(new ParentIdFilter(1));

Available Search Modifiers

Filters

ModifierCategoryDescription
IdFilterBasicFilter by element ID
IdsFilterBasicFilter by multiple element IDs
BooleanFilterBasicFilter boolean fields. Supports PQL field name resolution.
IntegerFilterBasicFilter integer fields. Supports PQL field name resolution.
NumberFilterBasicFilter number fields. Supports PQL field name resolution.
ExcludeFoldersFilterBasicExclude folders from results
ExcludeVariantsFilterBasicExclude data object variants from results
ParentIdsFilterTreeFilter by one or more parent IDs
PathFilterTreeFilter by path (all levels or direct children, with or without parent)
ClassIdsFilterTreeFilter objects by class IDs (optionally include folders). Set $useClassName to true to filter by class name instead.
TagFilterTreeFilter by tag IDs (optionally include child tags)
AssetMetaDataFilterAssetFilter by asset metadata attribute. The $data format depends on the metadata type and its field definition adapter.
WorkspaceQueryWorkspaceFilter by user workspaces and permissions for a single element type (added to asset/document/data object searches by default)
ElementWorkspacesQueryWorkspaceFilter by user workspaces across all element types (added to element search by default)
MultiSelectFilterField typeFilter text fields by exact string list. Supports PQL field name resolution.
BooleanMultiSelectFilterField typeFilter boolean fields by value list (true, false, null). Supports PQL field name resolution.
DateFilterField typeFilter date fields by exact date or date range. Supports PQL field name resolution.
ClassificationStoreFilterNestedFilter by classification store field values. Requires a sub-modifier matching the field type.
NestedFilterNestedFilter nested fields. Requires a sub-modifier matching the nested field type.

Full Text Search Queries

ModifierDescription
ElementKeySearchSearch by element key (as in Pimcore Studio) with wildcard support
FullTextSearchSearch all element fields using simple query string syntax (OpenSearch / Elasticsearch)
MultiMatchSearchSearch with configurable fields, match type (best_fields, most_fields, cross_fields, phrase, phrase_prefix), and operator (or/and). See OpenSearch / Elasticsearch docs.
WildcardSearchFilter text fields with wildcard support and PQL field name resolution

Dependencies

ModifierDescription
RequiresFilterGet all elements that the given element requires
RequiredByFilterGet all elements required by the given element

Query Language

ModifierDescription
PqlFilterApply a Pimcore Query Language (PQL) condition
TreePqlFilterQuery Language

Sort Modifiers

When multiple sort modifiers are added, they apply in order: the first modifier is the primary sort, the second is the secondary sort, and so on.

ModifierCategoryDescription
OrderByFullPathTreeSort by full path (including element key)
OrderByFieldFieldSort by field name. With $enablePqlFieldNameResolution set to true (default), short field names resolve automatically via PQL logic.
OrderByPageNumberSearchInverted search for large result sets. Applied automatically when results exceed 1,000 and the current page is past the halfway point. Requires existing sorting.
OrderByIndexFieldSearchSort by element tree index for custom tree ordering. Applies to data objects and documents only.

Aggregations

ModifierCategoryDescription
ChildrenCountAggregationTreeGet children counts for given element IDs
ChildFolderAggregationTree related aggregationGet the keys (names) of child folders at a specific tree level that contain descendants matching a search. Used internally by TreePqlFilter to determine which folders to display in filtered trees.
AssetMetaDataAggregationAssetAggregate filter options for supported metadata types (used in asset grid filters)
FileSizeSumAggregationAssetSum file sizes across assets for a search. Use FileSizeAggregationServiceInterface for a simplified API.

Implementation Details

Wildcard Support

Some modifiers support wildcard characters in search terms:

  • * matches any character sequence (e.g. Car* matches "Car", "Carbon", "Carpet")
  • ? matches exactly one character (e.g. Car? matches "Card", "Cars")

PQL Field Name Resolution

Some modifiers support Pimcore Query Language (PQL) field name resolution via $enablePqlFieldNameResolution (enabled by default). This allows using short field names instead of full indexed paths.

Creating Custom Search Modifiers

Creating a custom search modifier requires two steps:

1. Define the Modifier Model

Create a class implementing ModifierInterface. This model holds the modifier's configurable attributes. See IdFilter for an example.

2. Implement the Handler

Create a service with the AsSearchModifierHandler attribute. Apply the attribute to either a method or a class (uses __invoke).

The handler method requires exactly two parameters:

  • The modifier model (from step 1)
  • SearchModifierContextInterface $context

See BasicFilters for an example and the Default Search Models documentation for manipulating the search query.