Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance search doc: TrashService references, LocationList::getTotalCount() #2540

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$result = $this->locationService->find($filter, []);

$output->writeln('Found ' . $result->totalCount . ' items');
$output->writeln('Found ' . $result->getTotalCount() . ' items');

foreach ($result as $content) {
$output->writeln($content->getContent()->getName());
Expand Down
110 changes: 55 additions & 55 deletions docs/search/criteria_reference/search_criteria_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,64 @@ Due to this storage limitation, searching content using the Country field type o

## Search Criteria

|Search Criterion|Search based on|Content Search |Location Search |Filtering |
|-----|-----|-----|-----|-----|
|[Ancestor](ancestor_criterion.md)|Whether the content item is an ancestor of the provided location|✔ |✔ |✔ |
|[ContentId](contentid_criterion.md)|Content item's ID|✔ |✔ |✔ |
|[ContentName](contentname_criterion.md)|Content item's name|✔ |✔ |✔ |
|[ContentTypeGroupId](contenttypegroupid_criterion.md)|ID of the content item's content type group|✔ |✔ |✔ |
|[ContentTypeId](contenttypeid_criterion.md)|ID of the content item's content type|✔ |✔ |✔ |
|[ContentTypeIdentifier](contenttypeidentifier_criterion.md)|Identifier of the content item's content type|✔ |✔ |✔ |
|[CurrencyCodeCriterion](currencycode_criterion.md)|Currency code|✔ |✔ |✔ |
|[DateMetadata](datemetadata_criterion.md)|The date when content was created or last modified|✔ |✔ |✔ |
|[Depth](depth_criterion.md)|Location depth in the content tree| |✔ |✔ |
|[Field](field_criterion.md)|Content of one of content item's fields|✔ |✔ | |
|[FieldRelation](fieldrelation_criterion.md)|Content items the content in question has Relations to|✔ |✔ | |
|[FullText](fulltext_criterion.md)|Full text content of a content item's fields|✔ |✔ | |
|[Image](image_criterion.md)|Image by specified image attributes|✔|✔||
|[ImageDimensions](imagedimensions_criterion.md)|Image dimensions: height and width|✔|✔||
|[ImageFileSize](imagefilesize_criterion.md)|Image size in MB|✔|✔||
|[ImageHeight](imageheight_criterion.md)|Image height in pixels|✔|✔||
|[ImageMimeType](imagemimetype_criterion.md)|Image type|✔|✔||
|[ImageOrientation](imageorientation_criterion.md)|Image orientation|✔|✔||
|[ImageWidth](imagewidth_criterion.md)|Image width in pixels|✔|✔||
|[IsBookmarked](isbookmarked_criterion.md)|Whether a location is bookmarked or not| |✔ |✔ |
|[IsCurrencyEnabledCriterion](iscurrencyenabled_criterion.md)|Whether a specified currency is enabled in the system| | | |
|[IsFieldEmpty](isfieldempty_criterion.md)|Whether a specified field of a content item is empty or not|✔ |✔ | |
|[IsMainLocation](ismainlocation_criterion.md)|Whether a location is the main location of a content item| |✔ |✔ |
|[IsProductBased](isproductbased_criterion.md)|Whether content represents a product|✔ |✔ |✔ |
|[IsUserBased](isuserbased_criterion.md)|Whether content represents a User account|✔ |✔ |✔ |
|[IsUserEnabled](isuserenabled_criterion.md)|Whether a User account is enabled|✔ |✔ |✔ |
|[LanguageCode](languagecode_criterion.md)|Whether a content item is translated into the selected language|✔ |✔ |✔ |
|[LocationId](locationid_criterion.md)|Location ID|✔ |✔ |✔ |
|[LocationRemoteId](locationremoteid_criterion.md)|Location remote ID|✔ |✔ |✔ |
|[MapLocationDistance](maplocationdistance_criterion.md)|Distance between the location contained in a MapLocation field and the provided coordinates|✔ |✔ | |
|[MatchAll](matchall_criterion.md)|Returns all search results|✔ |✔ |✔ |
|[MatchNone](matchnone_criterion.md)|Returns no search results|✔ |✔ |✔ |
|[ObjectStateId](objectstateid_criterion.md)|Object state ID|✔ |✔ |✔ |
|[ObjectStateIdentifier](objectstateidentifier_criterion.md)|Object state Identifier|✔ |✔ |✔ |
|[ParentLocationId](parentlocationid_criterion.md)|Location ID of a content item's parent|✔ |✔ |✔ |
|[ParentLocationRemoteId](parentlocationremoteId_criterion.md)|Location remote ID of a content item's parent|✔ |✔ |
|[Priority](priority_criterion.md)|Location priority| |✔ |✔ |
|[RemoteId](remoteid_criterion.md)|Remote content ID|✔ |✔ |✔ |
|[SectionId](sectionid_criterion.md)|ID of the Section content is assigned to|✔ |✔ |✔ |
|[SectionIdentifier](sectionidentifier_criterion.md)|Identifier of the Section content is assigned to|✔ |✔ |✔ |
|[Sibling](sibling_criterion.md)|Locations that are children of the same parent|✔ |✔ |✔ |
|[Subtree](subtree_criterion.md)|Location subtree|✔ |✔ |✔ |
|[TaxonomyEntryId](taxonomy_entry_id.md)|Content tagged with Entry ID|✔ |✔ |✔ |
|[UserEmail](useremail_criterion.md)|Email address of a User account|✔ |✔ |✔ |
|[UserId](userid_criterion.md)|User ID|✔ |✔ |✔ |
|[UserLogin](userlogin_criterion.md)|User login|✔ |✔ |✔ |
|[UserMetadata](usermetadata_criterion.md)|The creator or modifier of a content item|✔ |✔ |✔ |
|[Visibility](visibility_criterion.md)|Whether the content item is visible or not|✔ |✔ |✔ |
| Search Criterion | Search based on | Content Search | Location Search | Filtering | Trash |
|---------------------------------------------------------------|---------------------------------------------------------------------------------------------|----------------|-----------------|-----------|----------|
| [Ancestor](ancestor_criterion.md) | Whether the content item is an ancestor of the provided location | ✔ | ✔ | ✔ | |
| [ContentId](contentid_criterion.md) | Content item's ID | ✔ | ✔ | ✔ | |
| [ContentName](contentname_criterion.md) | Content item's name | ✔ | ✔ | ✔ | |
| [ContentTypeGroupId](contenttypegroupid_criterion.md) | ID of the content item's content type group | ✔ | ✔ | ✔ | |
| [ContentTypeId](contenttypeid_criterion.md) | ID of the content item's content type | ✔ | ✔ | ✔ | ✔ |
| [ContentTypeIdentifier](contenttypeidentifier_criterion.md) | Identifier of the content item's content type | ✔ | ✔ | ✔ | |
| [CurrencyCodeCriterion](currencycode_criterion.md) | Currency code | ✔ | ✔ | ✔ | |
| [DateMetadata](datemetadata_criterion.md) | The date when content was created or last modified | ✔ | ✔ | ✔ | ✔ |
| [Depth](depth_criterion.md) | Location depth in the content tree | | ✔ | ✔ | |
| [Field](field_criterion.md) | Content of one of content item's fields | ✔ | ✔ | | |
| [FieldRelation](fieldrelation_criterion.md) | Content items the content in question has Relations to | ✔ | ✔ | | |
| [FullText](fulltext_criterion.md) | Full text content of a content item's fields | ✔ | ✔ | | |
| [Image](image_criterion.md) | Image by specified image attributes | ✔ | ✔ | | |
| [ImageDimensions](imagedimensions_criterion.md) | Image dimensions: height and width | ✔ | ✔ | | |
| [ImageFileSize](imagefilesize_criterion.md) | Image size in MB | ✔ | ✔ | | |
| [ImageHeight](imageheight_criterion.md) | Image height in pixels | ✔ | ✔ | | |
| [ImageMimeType](imagemimetype_criterion.md) | Image type | ✔ | ✔ | | |
| [ImageOrientation](imageorientation_criterion.md) | Image orientation | ✔ | ✔ | | |
| [ImageWidth](imagewidth_criterion.md) | Image width in pixels | ✔ | ✔ | | |
| [IsBookmarked](isbookmarked_criterion.md) | Whether a location is bookmarked or not | | ✔ | ✔ | |
| [IsCurrencyEnabledCriterion](iscurrencyenabled_criterion.md) | Whether a specified currency is enabled in the system | | | | |
| [IsFieldEmpty](isfieldempty_criterion.md) | Whether a specified field of a content item is empty or not | ✔ | ✔ | | |
| [IsMainLocation](ismainlocation_criterion.md) | Whether a location is the main location of a content item | | ✔ | ✔ | |
| [IsProductBased](isproductbased_criterion.md) | Whether content represents a product | ✔ | ✔ | ✔ | |
| [IsUserBased](isuserbased_criterion.md) | Whether content represents a User account | ✔ | ✔ | ✔ | |
| [IsUserEnabled](isuserenabled_criterion.md) | Whether a User account is enabled | ✔ | ✔ | ✔ | |
| [LanguageCode](languagecode_criterion.md) | Whether a content item is translated into the selected language | ✔ | ✔ | ✔ | |
| [LocationId](locationid_criterion.md) | Location ID | ✔ | ✔ | ✔ | |
| [LocationRemoteId](locationremoteid_criterion.md) | Location remote ID | ✔ | ✔ | ✔ | |
| [MapLocationDistance](maplocationdistance_criterion.md) | Distance between the location contained in a MapLocation field and the provided coordinates | ✔ | ✔ | | |
| [MatchAll](matchall_criterion.md) | Returns all search results | ✔ | ✔ | ✔ | ✔ |
| [MatchNone](matchnone_criterion.md) | Returns no search results | ✔ | ✔ | ✔ | ✔ |
| [ObjectStateId](objectstateid_criterion.md) | Object state ID | ✔ | ✔ | ✔ | |
| [ObjectStateIdentifier](objectstateidentifier_criterion.md) | Object state Identifier | ✔ | ✔ | ✔ | |
| [ParentLocationId](parentlocationid_criterion.md) | Location ID of a content item's parent | ✔ | ✔ | ✔ | |
| [ParentLocationRemoteId](parentlocationremoteId_criterion.md) | Location remote ID of a content item's parent | ✔ | ✔ | |
| [Priority](priority_criterion.md) | Location priority | | ✔ | ✔ | |
| [RemoteId](remoteid_criterion.md) | Remote content ID | ✔ | ✔ | ✔ | |
| [SectionId](sectionid_criterion.md) | ID of the Section content is assigned to | ✔ | ✔ | ✔ | ✔ |
| [SectionIdentifier](sectionidentifier_criterion.md) | Identifier of the Section content is assigned to | ✔ | ✔ | ✔ | |
| [Sibling](sibling_criterion.md) | Locations that are children of the same parent | ✔ | ✔ | ✔ | |
| [Subtree](subtree_criterion.md) | Location subtree | ✔ | ✔ | ✔ | |
| [TaxonomyEntryId](taxonomy_entry_id.md) | Content tagged with Entry ID | ✔ | ✔ | ✔ | |
| [UserEmail](useremail_criterion.md) | Email address of a User account | ✔ | ✔ | ✔ | |
| [UserId](userid_criterion.md) | User ID | ✔ | ✔ | ✔ | |
| [UserLogin](userlogin_criterion.md) | User login | ✔ | ✔ | ✔ | |
| [UserMetadata](usermetadata_criterion.md) | The creator or modifier of a content item | ✔ | ✔ | ✔ | ✔ |
| [Visibility](visibility_criterion.md) | Whether the content item is visible or not | ✔ | ✔ | ✔ | |

### Logical operators

All Logical operators are supported by Content and Location Search and
[Repository filtering](search_api.md#repository-filtering).

|Search Criterion|Search based on|
|-----|-----|
|[LogicalAnd](logicaland_criterion.md)|Implements a logical AND Criterion. It matches if ALL of the provided Criteria match.|
|[LogicalNot](logicalnot_criterion.md)|Implements a logical NOT Criterion. It matches if the provided Criterion doesn't match.|
|[LogicalOr](logicalor_criterion.md)|Implements a logical OR Criterion. It matches if at least one of the provided Criteria matches.|
| Search Criterion | Search based on |
|---------------------------------------|-------------------------------------------------------------------------------------------------|
| [LogicalAnd](logicaland_criterion.md) | Implements a logical AND Criterion. It matches if ALL of the provided Criteria match. |
| [LogicalNot](logicalnot_criterion.md) | Implements a logical NOT Criterion. It matches if the provided Criterion doesn't match. |
| [LogicalOr](logicalor_criterion.md) | Implements a logical OR Criterion. It matches if at least one of the provided Criteria matches. |
2 changes: 0 additions & 2 deletions docs/search/search_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ The same Filter can be applied to find locations instead of content items, for e
[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 32, 52) =]]
```

Notice that the total number of items is retrieved differently for `ContentList` and `LocationList`.

!!! caution

The total count is the total number of matched items, regardless of pagination settings.
Expand Down
7 changes: 4 additions & 3 deletions docs/search/search_in_trash_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

# Search in trash reference

When you [search for content items that are held in trash](search_api.md#searching-in-trash), you can apply only a limited set of Search Criteria and Sort Clauses.
They can be used by `Ibexa\Contracts\Core\Repository\TrashService::findTrashItems` only.
When you [search for content items that are held in trash](search_api.md#searching-in-trash), you can apply only a limited subset of Search Criteria and Sort Clauses
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).

Check failure on line 9 in docs/search/search_in_trash_reference.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/search_in_trash_reference.md#L9

[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'
Raw output
{"message": "[Ibexa.VariablesGlobal] Use global variable '[[= product_name_base =]]' instead of 'Ibexa'", "location": {"path": "docs/search/search_in_trash_reference.md", "range": {"start": {"line": 9, "column": 128}}}, "severity": "ERROR"}
Some sort clauses are exclusive to trash search.

Check failure on line 10 in docs/search/search_in_trash_reference.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/search_in_trash_reference.md#L10

[Ibexa.DomainTermCapitalization] Use 'Sort Clause(s)' instead of 'sort clauses'
Raw output
{"message": "[Ibexa.DomainTermCapitalization] Use 'Sort Clause(s)' instead of 'sort clauses'", "location": {"path": "docs/search/search_in_trash_reference.md", "range": {"start": {"line": 10, "column": 6}}}, "severity": "ERROR"}

## Search Criteria

- [ContentTypeId](contenttypeid_criterion.md)
- [DateMetadata](datemetadata_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)
Expand Down
Loading
Loading