Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Location/CriterionVisitor/ContentTypeGroupIdIn.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Elasticsearch\Content\Location\CriterionVisitor;
8
9 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitorDispatcher as Dispatcher;
10 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor;
11 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12 use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator;
13
17 class ContentTypeGroupIdIn extends CriterionVisitor
18 {
26 public function canVisit(Criterion $criterion)
27 {
28 return
29 $criterion instanceof Criterion\ContentTypeGroupId &&
30 (
31 ($criterion->operator ?: Operator::IN) === Operator::IN ||
32 $criterion->operator === Operator::EQ
33 );
34 }
35
45 public function visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
46 {
47 if (count($criterion->value) > 1) {
48 $filter = [
49 'terms' => [
50 'content_group_mid' => $criterion->value,
51 ],
52 ];
53 } else {
54 $filter = [
55 'term' => [
56 'content_group_mid' => $criterion->value[0],
57 ],
58 ];
59 }
60
61 return $filter;
62 }
63 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\EQ
const EQ
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:16
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\IN
const IN
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:21
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion.php:15
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitorDispatcher
Dispatches Criterion objects to a visitor depending on the query context.
Definition: CriterionVisitorDispatcher.php:19
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\ContentTypeGroupIdIn
Visits the ContentTypeGroupId criterion.
Definition: CriterionVisitor/ContentTypeGroupIdIn.php:18
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor
Visits the criterion tree into a hash representation of Elasticsearch query/filter AST.
Definition: CriterionVisitor.php:19
eZ\Publish\Core\Search\Elasticsearch\Content\Location\CriterionVisitor\ContentTypeGroupIdIn\visitFilter
visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
Map field value to a proper Elasticsearch filter representation.
Definition: Location/CriterionVisitor/ContentTypeGroupIdIn.php:45
eZ\Publish\Core\Search\Elasticsearch\Content\Location\CriterionVisitor\ContentTypeGroupIdIn\canVisit
canVisit(Criterion $criterion)
Check if visitor is applicable to current criterion.
Definition: Location/CriterionVisitor/ContentTypeGroupIdIn.php:26
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator
Definition: Specifications.php:7
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:7
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor
Definition: CriterionVisitor/ContentIdIn.php:7
eZ\Publish\Core\Search\Elasticsearch\Content\Location\CriterionVisitor
Definition: Location/CriterionVisitor/ContentIdIn.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.