Skip to content

TaxonomyNoEntries Criterion

The TaxonomyNoEntries Search Criterion searches for content that has no entries assigned from the specified taxonomy.

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

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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(
    [
        new TaxonomyNoEntries('tags'),
        new ContentTypeIdentifier('article'),
    ]
);

/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */
$results = $searchService->findContent($query);

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