From b586e269fbc741124f4c7bbf2a6295a7343a3585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 11 Mar 2026 12:20:11 +0100 Subject: [PATCH 1/3] Added doc for TaxonomyNoEntries --- .../content/taxonomy_no_entries_criterion.php | 18 ++++++++++++ .../taxonomy/taxonomy_api.md | 12 ++++++++ .../isfieldempty_criterion.md | 3 ++ .../search_criteria_reference.md | 1 + .../criteria_reference/taxonomy_no_entries.md | 29 +++++++++++++++++++ mkdocs.yml | 1 + 6 files changed, 64 insertions(+) create mode 100644 code_samples/search/content/taxonomy_no_entries_criterion.php create mode 100644 docs/search/criteria_reference/taxonomy_no_entries.md diff --git a/code_samples/search/content/taxonomy_no_entries_criterion.php b/code_samples/search/content/taxonomy_no_entries_criterion.php new file mode 100644 index 0000000000..1477f12e51 --- /dev/null +++ b/code_samples/search/content/taxonomy_no_entries_criterion.php @@ -0,0 +1,18 @@ +query = new LogicalAnd([ + new TaxonomyNoEntries('tags'), + new ContentTypeIdentifier('article'), + ] +); + +/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +$results = $searchService->findContent($query); diff --git a/docs/content_management/taxonomy/taxonomy_api.md b/docs/content_management/taxonomy/taxonomy_api.md index 3a46b2322f..3ad97d27dc 100644 --- a/docs/content_management/taxonomy/taxonomy_api.md +++ b/docs/content_management/taxonomy/taxonomy_api.md @@ -71,3 +71,15 @@ 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 | + +You can also use the [TaxonomyEntryId Aggregation](taxonomyentryid_aggregation.md) to count content items per taxonomy entry. diff --git a/docs/search/criteria_reference/isfieldempty_criterion.md b/docs/search/criteria_reference/isfieldempty_criterion.md index 97341ec019..8b7efaaec1 100644 --- a/docs/search/criteria_reference/isfieldempty_criterion.md +++ b/docs/search/criteria_reference/isfieldempty_criterion.md @@ -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 diff --git a/docs/search/criteria_reference/search_criteria_reference.md b/docs/search/criteria_reference/search_criteria_reference.md index 28c256aef2..c52bf7a01d 100644 --- a/docs/search/criteria_reference/search_criteria_reference.md +++ b/docs/search/criteria_reference/search_criteria_reference.md @@ -68,6 +68,7 @@ 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 | ✔ | ✔ | ✔ | | | [Subtree](subtree_criterion.md) | Location subtree | ✔ | ✔ | ✔ | | | [TaxonomyEntryId](taxonomy_entry_id.md) | Content tagged with Entry ID | ✔ | ✔ | ✔ | | +| [TaxonomyNoEntries](taxonomy_no_entries.md) | Content with no entries assigned from a given taxonomy | ✔ | ✔ | ✔ | | | [UserEmail](useremail_criterion.md) | Email address of a User account | ✔ | ✔ | ✔ | | | [UserId](userid_criterion.md) | User ID | ✔ | ✔ | ✔ | | | [UserLogin](userlogin_criterion.md) | User login | ✔ | ✔ | ✔ | | diff --git a/docs/search/criteria_reference/taxonomy_no_entries.md b/docs/search/criteria_reference/taxonomy_no_entries.md new file mode 100644 index 0000000000..d9c68828f5 --- /dev/null +++ b/docs/search/criteria_reference/taxonomy_no_entries.md @@ -0,0 +1,29 @@ +--- +description: TaxonomyNoEntries Search Criterion +--- + +# TaxonomyNoEntries Criterion + +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). + +Use it when you need to find content items to which no taxonomy entries have been assigned (for example, articles without tags). +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` diff --git a/mkdocs.yml b/mkdocs.yml index b34d2cb2df..a95060947d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -568,6 +568,7 @@ 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 - UserEmail: search/criteria_reference/useremail_criterion.md - UserId: search/criteria_reference/userid_criterion.md - UserLogin: search/criteria_reference/userlogin_criterion.md From 91bb827b84228ec6347fa74dc0e60084ebacb9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 11 Mar 2026 13:37:14 +0100 Subject: [PATCH 2/3] Added doc for Taxonomy subtree --- .../content/taxonomy_subtree_criterion.php | 18 +++++++++++++ .../taxonomy/taxonomy_api.md | 1 + .../search_criteria_reference.md | 1 + .../criteria_reference/taxonomy_subtree.md | 26 +++++++++++++++++++ mkdocs.yml | 1 + 5 files changed, 47 insertions(+) create mode 100644 code_samples/search/content/taxonomy_subtree_criterion.php create mode 100644 docs/search/criteria_reference/taxonomy_subtree.md diff --git a/code_samples/search/content/taxonomy_subtree_criterion.php b/code_samples/search/content/taxonomy_subtree_criterion.php new file mode 100644 index 0000000000..4f2a3318dd --- /dev/null +++ b/code_samples/search/content/taxonomy_subtree_criterion.php @@ -0,0 +1,18 @@ +query = new LogicalAnd([ + new TaxonomySubtree(42), + new ContentTypeIdentifier('article'), + ] +); + +/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +$results = $searchService->findContent($query); diff --git a/docs/content_management/taxonomy/taxonomy_api.md b/docs/content_management/taxonomy/taxonomy_api.md index 3ad97d27dc..49a992e859 100644 --- a/docs/content_management/taxonomy/taxonomy_api.md +++ b/docs/content_management/taxonomy/taxonomy_api.md @@ -81,5 +81,6 @@ You can search for content based on its taxonomy entry assignments by using the |---|---| | [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. diff --git a/docs/search/criteria_reference/search_criteria_reference.md b/docs/search/criteria_reference/search_criteria_reference.md index c52bf7a01d..2e73e8724c 100644 --- a/docs/search/criteria_reference/search_criteria_reference.md +++ b/docs/search/criteria_reference/search_criteria_reference.md @@ -69,6 +69,7 @@ Due to this storage limitation, searching content using the Country field type o | [Subtree](subtree_criterion.md) | Location subtree | ✔ | ✔ | ✔ | | | [TaxonomyEntryId](taxonomy_entry_id.md) | Content tagged with Entry ID | ✔ | ✔ | ✔ | | | [TaxonomyNoEntries](taxonomy_no_entries.md) | Content with no entries assigned from a given taxonomy | ✔ | ✔ | ✔ | | +| [TaxonomySubtree](taxonomy_subtree.md) | Content assigned to a taxonomy entry or any of its descendants | ✔ | ✔ | | | | [UserEmail](useremail_criterion.md) | Email address of a User account | ✔ | ✔ | ✔ | | | [UserId](userid_criterion.md) | User ID | ✔ | ✔ | ✔ | | | [UserLogin](userlogin_criterion.md) | User login | ✔ | ✔ | ✔ | | diff --git a/docs/search/criteria_reference/taxonomy_subtree.md b/docs/search/criteria_reference/taxonomy_subtree.md new file mode 100644 index 0000000000..0566b11a3c --- /dev/null +++ b/docs/search/criteria_reference/taxonomy_subtree.md @@ -0,0 +1,26 @@ +--- +description: TaxonomySubtree Search Criterion +--- + +# TaxonomySubtree Criterion + +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 +- content type is `article` diff --git a/mkdocs.yml b/mkdocs.yml index a95060947d..5c4e3605f9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -569,6 +569,7 @@ nav: - 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 From 8500d82fc29493baf4a818e6af2deaf9c44628ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 11 Mar 2026 13:38:39 +0100 Subject: [PATCH 3/3] Fixed CS --- .../search/content/taxonomy_no_entries_criterion.php | 7 ++++--- code_samples/search/content/taxonomy_subtree_criterion.php | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code_samples/search/content/taxonomy_no_entries_criterion.php b/code_samples/search/content/taxonomy_no_entries_criterion.php index 1477f12e51..048006d41c 100644 --- a/code_samples/search/content/taxonomy_no_entries_criterion.php +++ b/code_samples/search/content/taxonomy_no_entries_criterion.php @@ -8,9 +8,10 @@ use Ibexa\Contracts\Taxonomy\Search\Query\Criterion\TaxonomyNoEntries; $query = new Query(); -$query->query = new LogicalAnd([ - new TaxonomyNoEntries('tags'), - new ContentTypeIdentifier('article'), +$query->query = new LogicalAnd( + [ + new TaxonomyNoEntries('tags'), + new ContentTypeIdentifier('article'), ] ); diff --git a/code_samples/search/content/taxonomy_subtree_criterion.php b/code_samples/search/content/taxonomy_subtree_criterion.php index 4f2a3318dd..c13f94ed70 100644 --- a/code_samples/search/content/taxonomy_subtree_criterion.php +++ b/code_samples/search/content/taxonomy_subtree_criterion.php @@ -8,9 +8,10 @@ use Ibexa\Contracts\Taxonomy\Search\Query\Criterion\TaxonomySubtree; $query = new Query(); -$query->query = new LogicalAnd([ - new TaxonomySubtree(42), - new ContentTypeIdentifier('article'), +$query->query = new LogicalAnd( + [ + new TaxonomySubtree(42), + new ContentTypeIdentifier('article'), ] );