Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions code_samples/search/content/taxonomy_no_entries_criterion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd;
use Ibexa\Contracts\Taxonomy\Search\Query\Criterion\TaxonomyNoEntries;

$query = new Query();
$query->query = new LogicalAnd(
[

Check failure on line 12 in code_samples/search/content/taxonomy_no_entries_criterion.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.3)

Parameter #1 $criteria of class Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd constructor expects array<Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion>, array<int, Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier|Ibexa\Contracts\Taxonomy\Search\Query\Criterion\TaxonomyNoEntries> given.
new TaxonomyNoEntries('tags'),

Check failure on line 13 in code_samples/search/content/taxonomy_no_entries_criterion.php

View workflow job for this annotation

GitHub Actions / Validate code samples (8.3)

Instantiated class Ibexa\Contracts\Taxonomy\Search\Query\Criterion\TaxonomyNoEntries not found.
new ContentTypeIdentifier('article'),
]
);

/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */
$results = $searchService->findContent($query);
19 changes: 19 additions & 0 deletions code_samples/search/content/taxonomy_subtree_criterion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd;
use Ibexa\Contracts\Taxonomy\Search\Query\Criterion\TaxonomySubtree;

$query = new Query();
$query->query = new LogicalAnd(
[
new TaxonomySubtree(42),
new ContentTypeIdentifier('article'),
]
);

/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */
$results = $searchService->findContent($query);
13 changes: 13 additions & 0 deletions docs/content_management/taxonomy/taxonomy_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,16 @@ and a `position` parameter, which is either `TaxonomyServiceInterface::MOVE_POSI

Taxonomy entry management functions triggers events you can listen to.
For more information, see [Taxonomy events](taxonomy_events.md).

## Search

You can search for content based on its taxonomy entry assignments by using the standard
[`SearchService`](search_api.md) with taxonomy-specific Search Criteria:

| Criterion | Description |
|---|---|
| [TaxonomyEntryId](taxonomy_entry_id.md) | Find content assigned to a specific taxonomy entry |
| [TaxonomyNoEntries](taxonomy_no_entries.md) | Find content that has no entries assigned from a given taxonomy |
| [TaxonomySubtree](taxonomy_subtree.md) | Find content assigned to a taxonomy entry or any of its descendants |

You can also use the [TaxonomyEntryId Aggregation](taxonomyentryid_aggregation.md) to count content items per taxonomy entry.
3 changes: 3 additions & 0 deletions docs/search/criteria_reference/isfieldempty_criterion.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ The `IsFieldEmpty` Criterion isn't available in [Repository filtering](search_ap

The Richtext field type (`ezrichtext`) isn't searchable in the Legacy search engine.

The `IsFieldEmpty` criterion doesn't work for [Taxonomy entry assignment](taxonomyentryassignmentfield.md) fields.
For this use case, use [`TaxonomyNoEntries`](taxonomy_no_entries.md) instead.

## Example

### PHP
Expand Down
2 changes: 2 additions & 0 deletions docs/search/criteria_reference/search_criteria_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Due to this storage limitation, searching content using the Country field type o
| [Sibling](sibling_criterion.md) | Locations that are children of the same parent | &#10004; | &#10004; | &#10004; | |
| [Subtree](subtree_criterion.md) | Location subtree | &#10004; | &#10004; | &#10004; | |
| [TaxonomyEntryId](taxonomy_entry_id.md) | Content tagged with Entry ID | &#10004; | &#10004; | &#10004; | |
| [TaxonomyNoEntries](taxonomy_no_entries.md) | Content with no entries assigned from a given taxonomy | &#10004; | &#10004; | &#10004; | |
| [TaxonomySubtree](taxonomy_subtree.md) | Content assigned to a taxonomy entry or any of its descendants | &#10004; | &#10004; | | |
| [UserEmail](useremail_criterion.md) | Email address of a User account | &#10004; | &#10004; | &#10004; | |
| [UserId](userid_criterion.md) | User ID | &#10004; | &#10004; | &#10004; | |
| [UserLogin](userlogin_criterion.md) | User login | &#10004; | &#10004; | &#10004; | |
Expand Down
29 changes: 29 additions & 0 deletions docs/search/criteria_reference/taxonomy_no_entries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
description: TaxonomyNoEntries Search Criterion
---

# TaxonomyNoEntries Criterion

Check notice on line 5 in docs/search/criteria_reference/taxonomy_no_entries.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/taxonomy_no_entries.md#L5

[Ibexa.SentenceCapitalizationInHeadings] Use sentence-style capitalization in headings
Raw output
{"message": "[Ibexa.SentenceCapitalizationInHeadings] Use sentence-style capitalization in headings", "location": {"path": "docs/search/criteria_reference/taxonomy_no_entries.md", "range": {"start": {"line": 5, "column": 3}}}, "severity": "INFO"}

The [`TaxonomyNoEntries` Search Criterion](https://example.com/api/php_api/php_api_reference/classes/Ibexa-Contracts-Taxonomy-Search-Query-Criterion-TaxonomyNoEntries.html) searches for content that has no entries assigned from the specified [taxonomy](taxonomy.md).
Copy link
Contributor Author

@mnocon mnocon Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example.com is a TMP change that must be removed before merge - the criterion is not part of the PHP API reference until it's released


Use it when you need to find content items to which no taxonomy entries have been assigned (for example, articles without tags).

Check notice on line 9 in docs/search/criteria_reference/taxonomy_no_entries.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/taxonomy_no_entries.md#L9

[Ibexa.Passive] Try to avoid passive tense, when possible.
Raw output
{"message": "[Ibexa.Passive] Try to avoid passive tense, when possible.", "location": {"path": "docs/search/criteria_reference/taxonomy_no_entries.md", "range": {"start": {"line": 9, "column": 78}}}, "severity": "INFO"}
It is available for all supported search engines and in [repository filtering](search_api.md#repository-filtering)

## Arguments

- `taxonomy` - `string` representing the identifier of the taxonomy (for example, `tags` or `categories`)

## Example

### PHP

The following example searches for articles that have no entries assigned in the `tags` taxonomy:

```php hl_lines="11-14"
[[= include_file('code_samples/search/content/taxonomy_no_entries_criterion.php') =]]
```

The criteria limit the results to content matching all of the conditions listed below:

- content has no entries assigned in the `tags` taxonomy
- content type is `article`
26 changes: 26 additions & 0 deletions docs/search/criteria_reference/taxonomy_subtree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: TaxonomySubtree Search Criterion
---

# TaxonomySubtree Criterion

Check notice on line 5 in docs/search/criteria_reference/taxonomy_subtree.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/taxonomy_subtree.md#L5

[Ibexa.SentenceCapitalizationInHeadings] Use sentence-style capitalization in headings
Raw output
{"message": "[Ibexa.SentenceCapitalizationInHeadings] Use sentence-style capitalization in headings", "location": {"path": "docs/search/criteria_reference/taxonomy_subtree.md", "range": {"start": {"line": 5, "column": 3}}}, "severity": "INFO"}

The [`TaxonomySubtree` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Taxonomy-Search-Query-Criterion-TaxonomySubtree.html) searches for content assigned to the specified [taxonomy](taxonomy.md) entry or any of its descendants.

## Arguments

- `taxonomyEntryId` - `int` representing the ID of the taxonomy entry that is the root of the subtree

## Example

### PHP

The following example searches for articles assigned to taxonomy entry with ID `42` or any of its child entries:

```php hl_lines="11-14"
[[= include_file('code_samples/search/content/taxonomy_subtree_criterion.php') =]]
```

The criteria limit the results to content matching all of the conditions listed below:

- content is assigned to taxonomy entry `42` or any of its descendants

Check notice on line 25 in docs/search/criteria_reference/taxonomy_subtree.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/search/criteria_reference/taxonomy_subtree.md#L25

[Ibexa.Passive] Try to avoid passive tense, when possible.
Raw output
{"message": "[Ibexa.Passive] Try to avoid passive tense, when possible.", "location": {"path": "docs/search/criteria_reference/taxonomy_subtree.md", "range": {"start": {"line": 25, "column": 11}}}, "severity": "INFO"}
- content type is `article`
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ nav:
- Sibling: search/criteria_reference/sibling_criterion.md
- Subtree: search/criteria_reference/subtree_criterion.md
- TaxonomyEntryID: search/criteria_reference/taxonomy_entry_id.md
- TaxonomyNoEntries: search/criteria_reference/taxonomy_no_entries.md
- TaxonomySubtree: search/criteria_reference/taxonomy_subtree.md
- UserEmail: search/criteria_reference/useremail_criterion.md
- UserId: search/criteria_reference/userid_criterion.md
- UserLogin: search/criteria_reference/userlogin_criterion.md
Expand Down
Loading