From 5991f55b618c68a3d717e59cced28d9768907ee7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:30:55 +0000 Subject: [PATCH 1/7] Initial plan From f1a272e2331f4455b04133f039603cf0f2edec18 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:40:39 +0000 Subject: [PATCH 2/7] Improve Search in Trash reference: create separate criteria and sort clauses files with table format Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com> --- docs/search/search_in_trash_reference.md | 39 +++++--------- .../trash_criteria.md | 54 +++++++++++++++++++ .../trash_sort_clauses.md | 48 +++++++++++++++++ mkdocs.yml | 2 + 4 files changed, 117 insertions(+), 26 deletions(-) create mode 100644 docs/search/search_in_trash_reference/trash_criteria.md create mode 100644 docs/search/search_in_trash_reference/trash_sort_clauses.md diff --git a/docs/search/search_in_trash_reference.md b/docs/search/search_in_trash_reference.md index 681f53eaa5..ec804dd7db 100644 --- a/docs/search/search_in_trash_reference.md +++ b/docs/search/search_in_trash_reference.md @@ -10,29 +10,16 @@ When you [search for content items that are held in trash](search_api.md#searchi which can be used by [`Ibexa\Contracts\Core\Repository\TrashService::findTrashItems`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#method_findTrashItems). Some sort clauses are exclusive to trash search. -## Search Criteria - -- [ContentName](contentname_criterion.md) -- [ContentTypeId](contenttypeid_criterion.md) -- [DateMetadata](datemetadata_criterion.md) (which can use the additional exclusive target `DateMetadata::TRASHED`) -- [MatchAll](matchall_criterion.md) -- [MatchNone](matchnone_criterion.md) -- [SectionId](sectionid_criterion.md) -- [UserMetadata](usermetadata_criterion.md) - -## Logical operators - -- [LogicalAnd](logicaland_criterion.md) -- [LogicalNot](logicalor_criterion.md) -- [LogicalOr](logicalor_criterion.md) - -## Sort Clauses - -- [ContentName](contentname_sort_clause.md) -- [ContentTypeName](contenttypename_sort_clause.md) -- [DateTrashed](datetrashed_sort_clause.md) -- [Depth](depth_sort_clause.md) -- [Path](path_sort_clause.md) -- [Priority](priority_sort_clause.md) -- [SectionName](sectionname_sort_clause.md) -- [UserLogin](userlogin_sort_clause.md) +!!! note + + Searching through the trashed content items operates directly on the database, therefore you cannot use external search engines, such as Solr or Elasticsearch, and it's impossible to reindex the data. + +!!! caution + + Make sure that you set the Criterion on the `filter` property. + It's impossible to use the `query` property, because the search in trash operation filters the database instead of querying. + +For detailed information about available search options, see: + +- [Trash Search Criteria](search_in_trash_reference/trash_criteria.md) +- [Trash Search Sort Clauses](search_in_trash_reference/trash_sort_clauses.md) diff --git a/docs/search/search_in_trash_reference/trash_criteria.md b/docs/search/search_in_trash_reference/trash_criteria.md new file mode 100644 index 0000000000..591c047743 --- /dev/null +++ b/docs/search/search_in_trash_reference/trash_criteria.md @@ -0,0 +1,54 @@ +--- +description: Search Criteria for finding content items in trash. +page_type: reference +month_change: false +--- + +# Trash Search Criteria reference + +Search Criteria for trash are found in the [`Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion`](/api/php_api/php_api_reference/namespaces/ibexa-contracts-core-repository-values-content-query-criterion.html) namespace, implementing the [CriterionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-CriterionInterface.html) interface: + +| Criterion | Description | +|---|---| +| [ContentName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-ContentName.html) | Find content items by their name | +| [ContentTypeId](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-ContentTypeId.html) | Find content items by their Content Type ID | +| [DateMetadata](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-DateMetadata.html) | Find content items by metadata dates. Can use the additional exclusive target `DateMetadata::TRASHED` for trash-specific searches | +| [MatchAll](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-MatchAll.html) | Match all content items (no filtering) | +| [MatchNone](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-MatchNone.html) | Match no content items (filter out all) | +| [SectionId](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-SectionId.html) | Find content items by their Section ID | +| [UserMetadata](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-UserMetadata.html) | Find content items by user metadata (creator or modifier) | + +## Logical operators + +| Operator | Description | +|---|---| +| [LogicalAnd](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-LogicalAnd.html) | Composite criterion to group multiple criteria using the AND condition | +| [LogicalNot](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-LogicalNot.html) | Negate the result of the wrapped criterion | +| [LogicalOr](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-LogicalOr.html) | Composite criterion to group multiple criteria using the OR condition | + +You can use these criteria to build complex search queries for content items that are held in trash. The search is performed using the [`Ibexa\Contracts\Core\Repository\TrashService::findTrashItems`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#method_findTrashItems) method. + +The following example shows how you can use the criteria to find trashed content items: + +```php +use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; + +$query = new Query(); +$query->filter = new Criterion\LogicalAnd([ + new Criterion\ContentTypeId([2]), // Articles + new Criterion\DateMetadata( + Criterion\DateMetadata::TRASHED, + Criterion\Operator::GTE, + strtotime('-30 days') + ) +]); + +// Search for articles trashed in the last 30 days +$results = $trashService->findTrashItems($query); +``` + +The criteria limit the result set to content items matching all of the conditions listed below: + +- content type must be Article (Content Type ID: 2) +- content must have been trashed within the last 30 days \ No newline at end of file diff --git a/docs/search/search_in_trash_reference/trash_sort_clauses.md b/docs/search/search_in_trash_reference/trash_sort_clauses.md new file mode 100644 index 0000000000..a69e869bd5 --- /dev/null +++ b/docs/search/search_in_trash_reference/trash_sort_clauses.md @@ -0,0 +1,48 @@ +--- +description: Sort Clauses for ordering search results of content items in trash. +page_type: reference +month_change: false +--- + +# Trash Search Sort Clauses reference + +Sort Clauses for trash are found in the [`Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause`](/api/php_api/php_api_reference/namespaces/ibexa-contracts-core-repository-values-content-query-sortclause.html) namespace, implementing the [SortClauseInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClauseInterface.html) interface: + +| Name | Description | +| --- | --- | +| [ContentName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-ContentName.html) | Sort by content item name | +| [ContentTypeName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-ContentTypeName.html) | Sort by Content Type name | +| [DateTrashed](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-DateTrashed.html) | Sort by the date when content was moved to trash (exclusive to trash search) | +| [Depth](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Depth.html) | Sort by the original depth in the content tree | +| [Path](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Path.html) | Sort by the original path in the content tree | +| [Priority](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Priority.html) | Sort by content item priority | +| [SectionName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-SectionName.html) | Sort by Section name | +| [UserLogin](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-UserLogin.html) | Sort by the login of the user who created the content | + +The following example shows how to use sort clauses to order the searched trash items: + +```php +use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; + +$query = new Query(); +$query->sortClauses = [ + new SortClause\DateTrashed(Query::SORT_DESC), + new SortClause\ContentName(Query::SORT_ASC), + new SortClause\ContentTypeName(Query::SORT_ASC) +]; + +// Search results will be sorted by: +// 1. Date trashed (most recent first) +// 2. Content name (alphabetically) +// 3. Content Type name (alphabetically) +$results = $trashService->findTrashItems($query); +``` + +The returned trash items are sorted by: + +- date when content was trashed (descending - most recent first) +- content name (ascending - alphabetically) +- Content Type name (ascending - alphabetically) + +You can change the default sorting order by using the `Query::SORT_ASC` and `Query::SORT_DESC` constants from [`Query`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query.html#constants). \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 3c01ef57c2..dcf478d431 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -672,6 +672,7 @@ nav: - UserCriterion: search/activity_log_search_reference/user_criterion.md - Action Configuration Search Criteria: search/ai_actions_search_reference/action_configuration_criteria.md - Discounts Search Criteria: search/discounts_search_reference/discounts_criteria.md + - Trash Search Criteria: search/search_in_trash_reference/trash_criteria.md - Notification Search Criteria: - Notification Search Criteria: search/criteria_reference/notification_search_criteria.md - DateCreated: search/criteria_reference/notification_datecreated_criterion.md @@ -746,6 +747,7 @@ nav: - Activity Log Sort Clauses: search/activity_log_search_reference/activity_log_sort_clauses.md - Action Configuration Sort Clauses: search/ai_actions_search_reference/action_configuration_sort_clauses.md - Discounts Sort Clauses: search/discounts_search_reference/discounts_sort_clauses.md + - Trash Sort Clauses: search/search_in_trash_reference/trash_sort_clauses.md - Aggregation reference: # Content aggregations - Aggregation reference: search/aggregation_reference/aggregation_reference.md From acc530886d09e53b00db9a98f44614665a44fb4a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:06:36 +0000 Subject: [PATCH 3/7] Fix links to use original relative paths instead of API reference URLs Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com> --- .../trash_criteria.md | 24 +++++++++---------- .../trash_sort_clauses.md | 20 +++++++--------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/docs/search/search_in_trash_reference/trash_criteria.md b/docs/search/search_in_trash_reference/trash_criteria.md index 591c047743..6be0cdec51 100644 --- a/docs/search/search_in_trash_reference/trash_criteria.md +++ b/docs/search/search_in_trash_reference/trash_criteria.md @@ -6,27 +6,25 @@ month_change: false # Trash Search Criteria reference -Search Criteria for trash are found in the [`Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion`](/api/php_api/php_api_reference/namespaces/ibexa-contracts-core-repository-values-content-query-criterion.html) namespace, implementing the [CriterionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-CriterionInterface.html) interface: - | Criterion | Description | |---|---| -| [ContentName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-ContentName.html) | Find content items by their name | -| [ContentTypeId](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-ContentTypeId.html) | Find content items by their Content Type ID | -| [DateMetadata](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-DateMetadata.html) | Find content items by metadata dates. Can use the additional exclusive target `DateMetadata::TRASHED` for trash-specific searches | -| [MatchAll](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-MatchAll.html) | Match all content items (no filtering) | -| [MatchNone](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-MatchNone.html) | Match no content items (filter out all) | -| [SectionId](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-SectionId.html) | Find content items by their Section ID | -| [UserMetadata](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-UserMetadata.html) | Find content items by user metadata (creator or modifier) | +| [ContentName](../contentname_criterion.md) | Find content items by their name | +| [ContentTypeId](../contenttypeid_criterion.md) | Find content items by their Content Type ID | +| [DateMetadata](../datemetadata_criterion.md) | Find content items by metadata dates. Can use the additional exclusive target `DateMetadata::TRASHED` for trash-specific searches | +| [MatchAll](../matchall_criterion.md) | Match all content items (no filtering) | +| [MatchNone](../matchnone_criterion.md) | Match no content items (filter out all) | +| [SectionId](../sectionid_criterion.md) | Find content items by their Section ID | +| [UserMetadata](../usermetadata_criterion.md) | Find content items by user metadata (creator or modifier) | ## Logical operators | Operator | Description | |---|---| -| [LogicalAnd](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-LogicalAnd.html) | Composite criterion to group multiple criteria using the AND condition | -| [LogicalNot](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-LogicalNot.html) | Negate the result of the wrapped criterion | -| [LogicalOr](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-LogicalOr.html) | Composite criterion to group multiple criteria using the OR condition | +| [LogicalAnd](../logicaland_criterion.md) | Composite criterion to group multiple criteria using the AND condition | +| [LogicalNot](../logicalor_criterion.md) | Negate the result of the wrapped criterion | +| [LogicalOr](../logicalor_criterion.md) | Composite criterion to group multiple criteria using the OR condition | -You can use these criteria to build complex search queries for content items that are held in trash. The search is performed using the [`Ibexa\Contracts\Core\Repository\TrashService::findTrashItems`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#method_findTrashItems) method. +You can use these criteria to build complex search queries for content items that are held in trash. The following example shows how you can use the criteria to find trashed content items: diff --git a/docs/search/search_in_trash_reference/trash_sort_clauses.md b/docs/search/search_in_trash_reference/trash_sort_clauses.md index a69e869bd5..afcf851cee 100644 --- a/docs/search/search_in_trash_reference/trash_sort_clauses.md +++ b/docs/search/search_in_trash_reference/trash_sort_clauses.md @@ -6,18 +6,16 @@ month_change: false # Trash Search Sort Clauses reference -Sort Clauses for trash are found in the [`Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause`](/api/php_api/php_api_reference/namespaces/ibexa-contracts-core-repository-values-content-query-sortclause.html) namespace, implementing the [SortClauseInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClauseInterface.html) interface: - | Name | Description | | --- | --- | -| [ContentName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-ContentName.html) | Sort by content item name | -| [ContentTypeName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-ContentTypeName.html) | Sort by Content Type name | -| [DateTrashed](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-DateTrashed.html) | Sort by the date when content was moved to trash (exclusive to trash search) | -| [Depth](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Depth.html) | Sort by the original depth in the content tree | -| [Path](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Path.html) | Sort by the original path in the content tree | -| [Priority](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Priority.html) | Sort by content item priority | -| [SectionName](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-SectionName.html) | Sort by Section name | -| [UserLogin](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-UserLogin.html) | Sort by the login of the user who created the content | +| [ContentName](../contentname_sort_clause.md) | Sort by content item name | +| [ContentTypeName](../contenttypename_sort_clause.md) | Sort by Content Type name | +| [DateTrashed](../datetrashed_sort_clause.md) | Sort by the date when content was moved to trash (exclusive to trash search) | +| [Depth](../depth_sort_clause.md) | Sort by the original depth in the content tree | +| [Path](../path_sort_clause.md) | Sort by the original path in the content tree | +| [Priority](../priority_sort_clause.md) | Sort by content item priority | +| [SectionName](../sectionname_sort_clause.md) | Sort by Section name | +| [UserLogin](../userlogin_sort_clause.md) | Sort by the login of the user who created the content | The following example shows how to use sort clauses to order the searched trash items: @@ -45,4 +43,4 @@ The returned trash items are sorted by: - content name (ascending - alphabetically) - Content Type name (ascending - alphabetically) -You can change the default sorting order by using the `Query::SORT_ASC` and `Query::SORT_DESC` constants from [`Query`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query.html#constants). \ No newline at end of file +You can change the default sorting order by using the `Query::SORT_ASC` and `Query::SORT_DESC` constants. \ No newline at end of file From 6d799a59489aa4990ae85029dada5ce8d9599e3a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:28:09 +0000 Subject: [PATCH 4/7] Consolidate to single page with table layout and code examples Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com> --- docs/search/search_in_trash_reference.md | 64 ++++++++++++++++--- .../trash_criteria.md | 52 --------------- .../trash_sort_clauses.md | 46 ------------- mkdocs.yml | 2 - 4 files changed, 56 insertions(+), 108 deletions(-) delete mode 100644 docs/search/search_in_trash_reference/trash_criteria.md delete mode 100644 docs/search/search_in_trash_reference/trash_sort_clauses.md diff --git a/docs/search/search_in_trash_reference.md b/docs/search/search_in_trash_reference.md index ec804dd7db..44bc6e76ad 100644 --- a/docs/search/search_in_trash_reference.md +++ b/docs/search/search_in_trash_reference.md @@ -10,16 +10,64 @@ When you [search for content items that are held in trash](search_api.md#searchi which can be used by [`Ibexa\Contracts\Core\Repository\TrashService::findTrashItems`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#method_findTrashItems). Some sort clauses are exclusive to trash search. -!!! note +## Search Criteria - Searching through the trashed content items operates directly on the database, therefore you cannot use external search engines, such as Solr or Elasticsearch, and it's impossible to reindex the data. +| Criterion | Description | +|---|---| +| [ContentName](contentname_criterion.md) | Find content items by their name | +| [ContentTypeId](contenttypeid_criterion.md) | Find content items by their Content Type ID | +| [DateMetadata](datemetadata_criterion.md) | Find content items by metadata dates. Can use the additional exclusive target `DateMetadata::TRASHED` for trash-specific searches | +| [MatchAll](matchall_criterion.md) | Match all content items (no filtering) | +| [MatchNone](matchnone_criterion.md) | Match no content items (filter out all) | +| [SectionId](sectionid_criterion.md) | Find content items by their Section ID | +| [UserMetadata](usermetadata_criterion.md) | Find content items by user metadata (creator or modifier) | -!!! caution +## Logical operators - Make sure that you set the Criterion on the `filter` property. - It's impossible to use the `query` property, because the search in trash operation filters the database instead of querying. +| Operator | Description | +|---|---| +| [LogicalAnd](logicaland_criterion.md) | Composite criterion to group multiple criteria using the AND condition | +| [LogicalNot](logicalor_criterion.md) | Negate the result of the wrapped criterion | +| [LogicalOr](logicalor_criterion.md) | Composite criterion to group multiple criteria using the OR condition | -For detailed information about available search options, see: +## Sort Clauses -- [Trash Search Criteria](search_in_trash_reference/trash_criteria.md) -- [Trash Search Sort Clauses](search_in_trash_reference/trash_sort_clauses.md) +| Name | Description | +| --- | --- | +| [ContentName](contentname_sort_clause.md) | Sort by content item name | +| [ContentTypeName](contenttypename_sort_clause.md) | Sort by Content Type name | +| [DateTrashed](datetrashed_sort_clause.md) | Sort by the date when content was moved to trash (exclusive to trash search) | +| [Depth](depth_sort_clause.md) | Sort by the original depth in the content tree | +| [Path](path_sort_clause.md) | Sort by the original path in the content tree | +| [Priority](priority_sort_clause.md) | Sort by content item priority | +| [SectionName](sectionname_sort_clause.md) | Sort by Section name | +| [UserLogin](userlogin_sort_clause.md) | Sort by the login of the user who created the content | + +The following example shows how you can use the criteria and sort clauses to find trashed content items: + +```php +use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; + +$query = new Query(); +$query->filter = new Criterion\LogicalAnd([ + new Criterion\ContentTypeId([2]), // Articles + new Criterion\DateMetadata( + Criterion\DateMetadata::TRASHED, + Criterion\Operator::GTE, + strtotime('-30 days') + ) +]); + +$query->sortClauses = [ + new SortClause\DateTrashed(Query::SORT_DESC), + new SortClause\ContentName(Query::SORT_ASC), + new SortClause\ContentTypeName(Query::SORT_ASC) +]; + +// Search for articles trashed in the last 30 days +// Results will be sorted by date trashed (most recent first), +// then by content name and Content Type name (alphabetically) +$results = $trashService->findTrashItems($query); +``` diff --git a/docs/search/search_in_trash_reference/trash_criteria.md b/docs/search/search_in_trash_reference/trash_criteria.md deleted file mode 100644 index 6be0cdec51..0000000000 --- a/docs/search/search_in_trash_reference/trash_criteria.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -description: Search Criteria for finding content items in trash. -page_type: reference -month_change: false ---- - -# Trash Search Criteria reference - -| Criterion | Description | -|---|---| -| [ContentName](../contentname_criterion.md) | Find content items by their name | -| [ContentTypeId](../contenttypeid_criterion.md) | Find content items by their Content Type ID | -| [DateMetadata](../datemetadata_criterion.md) | Find content items by metadata dates. Can use the additional exclusive target `DateMetadata::TRASHED` for trash-specific searches | -| [MatchAll](../matchall_criterion.md) | Match all content items (no filtering) | -| [MatchNone](../matchnone_criterion.md) | Match no content items (filter out all) | -| [SectionId](../sectionid_criterion.md) | Find content items by their Section ID | -| [UserMetadata](../usermetadata_criterion.md) | Find content items by user metadata (creator or modifier) | - -## Logical operators - -| Operator | Description | -|---|---| -| [LogicalAnd](../logicaland_criterion.md) | Composite criterion to group multiple criteria using the AND condition | -| [LogicalNot](../logicalor_criterion.md) | Negate the result of the wrapped criterion | -| [LogicalOr](../logicalor_criterion.md) | Composite criterion to group multiple criteria using the OR condition | - -You can use these criteria to build complex search queries for content items that are held in trash. - -The following example shows how you can use the criteria to find trashed content items: - -```php -use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; - -$query = new Query(); -$query->filter = new Criterion\LogicalAnd([ - new Criterion\ContentTypeId([2]), // Articles - new Criterion\DateMetadata( - Criterion\DateMetadata::TRASHED, - Criterion\Operator::GTE, - strtotime('-30 days') - ) -]); - -// Search for articles trashed in the last 30 days -$results = $trashService->findTrashItems($query); -``` - -The criteria limit the result set to content items matching all of the conditions listed below: - -- content type must be Article (Content Type ID: 2) -- content must have been trashed within the last 30 days \ No newline at end of file diff --git a/docs/search/search_in_trash_reference/trash_sort_clauses.md b/docs/search/search_in_trash_reference/trash_sort_clauses.md deleted file mode 100644 index afcf851cee..0000000000 --- a/docs/search/search_in_trash_reference/trash_sort_clauses.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -description: Sort Clauses for ordering search results of content items in trash. -page_type: reference -month_change: false ---- - -# Trash Search Sort Clauses reference - -| Name | Description | -| --- | --- | -| [ContentName](../contentname_sort_clause.md) | Sort by content item name | -| [ContentTypeName](../contenttypename_sort_clause.md) | Sort by Content Type name | -| [DateTrashed](../datetrashed_sort_clause.md) | Sort by the date when content was moved to trash (exclusive to trash search) | -| [Depth](../depth_sort_clause.md) | Sort by the original depth in the content tree | -| [Path](../path_sort_clause.md) | Sort by the original path in the content tree | -| [Priority](../priority_sort_clause.md) | Sort by content item priority | -| [SectionName](../sectionname_sort_clause.md) | Sort by Section name | -| [UserLogin](../userlogin_sort_clause.md) | Sort by the login of the user who created the content | - -The following example shows how to use sort clauses to order the searched trash items: - -```php -use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; - -$query = new Query(); -$query->sortClauses = [ - new SortClause\DateTrashed(Query::SORT_DESC), - new SortClause\ContentName(Query::SORT_ASC), - new SortClause\ContentTypeName(Query::SORT_ASC) -]; - -// Search results will be sorted by: -// 1. Date trashed (most recent first) -// 2. Content name (alphabetically) -// 3. Content Type name (alphabetically) -$results = $trashService->findTrashItems($query); -``` - -The returned trash items are sorted by: - -- date when content was trashed (descending - most recent first) -- content name (ascending - alphabetically) -- Content Type name (ascending - alphabetically) - -You can change the default sorting order by using the `Query::SORT_ASC` and `Query::SORT_DESC` constants. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index dcf478d431..3c01ef57c2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -672,7 +672,6 @@ nav: - UserCriterion: search/activity_log_search_reference/user_criterion.md - Action Configuration Search Criteria: search/ai_actions_search_reference/action_configuration_criteria.md - Discounts Search Criteria: search/discounts_search_reference/discounts_criteria.md - - Trash Search Criteria: search/search_in_trash_reference/trash_criteria.md - Notification Search Criteria: - Notification Search Criteria: search/criteria_reference/notification_search_criteria.md - DateCreated: search/criteria_reference/notification_datecreated_criterion.md @@ -747,7 +746,6 @@ nav: - Activity Log Sort Clauses: search/activity_log_search_reference/activity_log_sort_clauses.md - Action Configuration Sort Clauses: search/ai_actions_search_reference/action_configuration_sort_clauses.md - Discounts Sort Clauses: search/discounts_search_reference/discounts_sort_clauses.md - - Trash Sort Clauses: search/search_in_trash_reference/trash_sort_clauses.md - Aggregation reference: # Content aggregations - Aggregation reference: search/aggregation_reference/aggregation_reference.md From 1fc5d14b96ec118ea45adfd80af821832642a2f9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 14:23:53 +0000 Subject: [PATCH 5/7] Fix code sample to match existing patterns and simplify example Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com> --- docs/search/search_in_trash_reference.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/docs/search/search_in_trash_reference.md b/docs/search/search_in_trash_reference.md index 44bc6e76ad..27f987a6bc 100644 --- a/docs/search/search_in_trash_reference.md +++ b/docs/search/search_in_trash_reference.md @@ -51,23 +51,15 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; $query = new Query(); -$query->filter = new Criterion\LogicalAnd([ - new Criterion\ContentTypeId([2]), // Articles - new Criterion\DateMetadata( - Criterion\DateMetadata::TRASHED, - Criterion\Operator::GTE, - strtotime('-30 days') - ) -]); +// Find trashed articles +$query->filter = new Criterion\ContentTypeId([2]); + +// Sort by date trashed (most recent first), then by content name $query->sortClauses = [ new SortClause\DateTrashed(Query::SORT_DESC), - new SortClause\ContentName(Query::SORT_ASC), - new SortClause\ContentTypeName(Query::SORT_ASC) + new SortClause\ContentName(Query::SORT_ASC) ]; -// Search for articles trashed in the last 30 days -// Results will be sorted by date trashed (most recent first), -// then by content name and Content Type name (alphabetically) $results = $trashService->findTrashItems($query); ``` From 1cc7927c60ef3cb9418f1ac0a5fbaf45dff13d5d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 14:36:32 +0000 Subject: [PATCH 6/7] Fix DateTrashed FQCN and restore 30-day search example Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com> --- docs/search/search_in_trash_reference.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/search/search_in_trash_reference.md b/docs/search/search_in_trash_reference.md index 27f987a6bc..6eb368c7e0 100644 --- a/docs/search/search_in_trash_reference.md +++ b/docs/search/search_in_trash_reference.md @@ -51,15 +51,23 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; $query = new Query(); +$query->filter = new Criterion\LogicalAnd([ + new Criterion\ContentTypeId([2]), // Articles + new Criterion\DateMetadata( + Criterion\DateMetadata::TRASHED, + Criterion\Operator::GTE, + strtotime('-30 days') + ) +]); -// Find trashed articles -$query->filter = new Criterion\ContentTypeId([2]); - -// Sort by date trashed (most recent first), then by content name $query->sortClauses = [ - new SortClause\DateTrashed(Query::SORT_DESC), - new SortClause\ContentName(Query::SORT_ASC) + new SortClause\Trash\DateTrashed(Query::SORT_DESC), + new SortClause\ContentName(Query::SORT_ASC), + new SortClause\ContentTypeName(Query::SORT_ASC) ]; +// Search for articles trashed in the last 30 days +// Results will be sorted by date trashed (most recent first), +// then by content name and Content Type name (alphabetically) $results = $trashService->findTrashItems($query); ``` From de6d50b51026d99c11dfec68adc482516119ce18 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 26 Sep 2025 10:34:06 +0200 Subject: [PATCH 7/7] Fixed FQCN of ContentTypeName criterion in code sample --- docs/search/search_in_trash_reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/search/search_in_trash_reference.md b/docs/search/search_in_trash_reference.md index 6eb368c7e0..69a77e05bc 100644 --- a/docs/search/search_in_trash_reference.md +++ b/docs/search/search_in_trash_reference.md @@ -63,7 +63,7 @@ $query->filter = new Criterion\LogicalAnd([ $query->sortClauses = [ new SortClause\Trash\DateTrashed(Query::SORT_DESC), new SortClause\ContentName(Query::SORT_ASC), - new SortClause\ContentTypeName(Query::SORT_ASC) + new SortClause\Trash\ContentTypeName(Query::SORT_ASC) ]; // Search for articles trashed in the last 30 days