Skip to content

Commit 6d799a5

Browse files
Copilotalongosz
andcommitted
Consolidate to single page with table layout and code examples
Co-authored-by: alongosz <7099219+alongosz@users.noreply.github.com>
1 parent acc5308 commit 6d799a5

File tree

4 files changed

+56
-108
lines changed

4 files changed

+56
-108
lines changed

docs/search/search_in_trash_reference.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,64 @@ When you [search for content items that are held in trash](search_api.md#searchi
1010
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).
1111
Some sort clauses are exclusive to trash search.
1212

13-
!!! note
13+
## Search Criteria
1414

15-
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.
15+
| Criterion | Description |
16+
|---|---|
17+
| [ContentName](contentname_criterion.md) | Find content items by their name |
18+
| [ContentTypeId](contenttypeid_criterion.md) | Find content items by their Content Type ID |
19+
| [DateMetadata](datemetadata_criterion.md) | Find content items by metadata dates. Can use the additional exclusive target `DateMetadata::TRASHED` for trash-specific searches |
20+
| [MatchAll](matchall_criterion.md) | Match all content items (no filtering) |
21+
| [MatchNone](matchnone_criterion.md) | Match no content items (filter out all) |
22+
| [SectionId](sectionid_criterion.md) | Find content items by their Section ID |
23+
| [UserMetadata](usermetadata_criterion.md) | Find content items by user metadata (creator or modifier) |
1624

17-
!!! caution
25+
## Logical operators
1826

19-
Make sure that you set the Criterion on the `filter` property.
20-
It's impossible to use the `query` property, because the search in trash operation filters the database instead of querying.
27+
| Operator | Description |
28+
|---|---|
29+
| [LogicalAnd](logicaland_criterion.md) | Composite criterion to group multiple criteria using the AND condition |
30+
| [LogicalNot](logicalor_criterion.md) | Negate the result of the wrapped criterion |
31+
| [LogicalOr](logicalor_criterion.md) | Composite criterion to group multiple criteria using the OR condition |
2132

22-
For detailed information about available search options, see:
33+
## Sort Clauses
2334

24-
- [Trash Search Criteria](search_in_trash_reference/trash_criteria.md)
25-
- [Trash Search Sort Clauses](search_in_trash_reference/trash_sort_clauses.md)
35+
| Name | Description |
36+
| --- | --- |
37+
| [ContentName](contentname_sort_clause.md) | Sort by content item name |
38+
| [ContentTypeName](contenttypename_sort_clause.md) | Sort by Content Type name |
39+
| [DateTrashed](datetrashed_sort_clause.md) | Sort by the date when content was moved to trash (exclusive to trash search) |
40+
| [Depth](depth_sort_clause.md) | Sort by the original depth in the content tree |
41+
| [Path](path_sort_clause.md) | Sort by the original path in the content tree |
42+
| [Priority](priority_sort_clause.md) | Sort by content item priority |
43+
| [SectionName](sectionname_sort_clause.md) | Sort by Section name |
44+
| [UserLogin](userlogin_sort_clause.md) | Sort by the login of the user who created the content |
45+
46+
The following example shows how you can use the criteria and sort clauses to find trashed content items:
47+
48+
```php
49+
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
50+
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
51+
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
52+
53+
$query = new Query();
54+
$query->filter = new Criterion\LogicalAnd([
55+
new Criterion\ContentTypeId([2]), // Articles
56+
new Criterion\DateMetadata(
57+
Criterion\DateMetadata::TRASHED,
58+
Criterion\Operator::GTE,
59+
strtotime('-30 days')
60+
)
61+
]);
62+
63+
$query->sortClauses = [
64+
new SortClause\DateTrashed(Query::SORT_DESC),
65+
new SortClause\ContentName(Query::SORT_ASC),
66+
new SortClause\ContentTypeName(Query::SORT_ASC)
67+
];
68+
69+
// Search for articles trashed in the last 30 days
70+
// Results will be sorted by date trashed (most recent first),
71+
// then by content name and Content Type name (alphabetically)
72+
$results = $trashService->findTrashItems($query);
73+
```

docs/search/search_in_trash_reference/trash_criteria.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

docs/search/search_in_trash_reference/trash_sort_clauses.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

mkdocs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,6 @@ nav:
672672
- UserCriterion: search/activity_log_search_reference/user_criterion.md
673673
- Action Configuration Search Criteria: search/ai_actions_search_reference/action_configuration_criteria.md
674674
- Discounts Search Criteria: search/discounts_search_reference/discounts_criteria.md
675-
- Trash Search Criteria: search/search_in_trash_reference/trash_criteria.md
676675
- Notification Search Criteria:
677676
- Notification Search Criteria: search/criteria_reference/notification_search_criteria.md
678677
- DateCreated: search/criteria_reference/notification_datecreated_criterion.md
@@ -747,7 +746,6 @@ nav:
747746
- Activity Log Sort Clauses: search/activity_log_search_reference/activity_log_sort_clauses.md
748747
- Action Configuration Sort Clauses: search/ai_actions_search_reference/action_configuration_sort_clauses.md
749748
- Discounts Sort Clauses: search/discounts_search_reference/discounts_sort_clauses.md
750-
- Trash Sort Clauses: search/search_in_trash_reference/trash_sort_clauses.md
751749
- Aggregation reference:
752750
# Content aggregations
753751
- Aggregation reference: search/aggregation_reference/aggregation_reference.md

0 commit comments

Comments
 (0)