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

Core/Search/Elasticsearch/Content/FacetBuilderVisitor/Section.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor;
8
9 use eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor;
10 use eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder;
11 use eZ\Publish\API\Repository\Values\Content\Search\Facet;
12
16 class Section extends FacetBuilderVisitor
17 {
25 public function canMap($name)
26 {
27 return substr($name, 0, 9) === 'section__';
28 }
29
38 public function map($name, $data)
39 {
40 return new Facet\SectionFacet(
41 [
42 'name' => (string)substr($name, 9),
43 'entries' => $this->mapData($data),
44 ]
45 );
46 }
47
55 public function canVisit(FacetBuilder $facetBuilder)
56 {
57 return $facetBuilder instanceof FacetBuilder\SectionFacetBuilder;
58 }
59
67 public function visit(FacetBuilder $facetBuilder)
68 {
69 return [
70 "section__{$facetBuilder->name}" => [
71 'terms' => [
72 'field' => 'section_id',
73 'min_doc_count' => $facetBuilder->minCount,
74 'size' => $facetBuilder->limit,
75 ],
76 ],
77 ];
78 }
79 }
eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder
This class is the base class for facet builders.
Definition: FacetBuilder.php:15
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor\Section
Visits the Section facet builder.
Definition: Core/Search/Elasticsearch/Content/FacetBuilderVisitor/Section.php:17
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor\Section\canMap
canMap($name)
Check if visitor is applicable to current facet result.
Definition: Core/Search/Elasticsearch/Content/FacetBuilderVisitor/Section.php:25
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor\Section\visit
visit(FacetBuilder $facetBuilder)
Map facet builder to a proper Elasticsearch representation.
Definition: Core/Search/Elasticsearch/Content/FacetBuilderVisitor/Section.php:67
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor\Section\map
map($name, $data)
Map Elasticsearch facet result back to facet objects.
Definition: Core/Search/Elasticsearch/Content/FacetBuilderVisitor/Section.php:38
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor\Section\canVisit
canVisit(FacetBuilder $facetBuilder)
Check if visitor is applicable to current facet builder.
Definition: Core/Search/Elasticsearch/Content/FacetBuilderVisitor/Section.php:55
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor
Visits the facet builder tree into a hash representation of Elasticsearch aggregations.
Definition: FacetBuilderVisitor.php:17
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor\mapData
mapData($data)
Map Elasticsearch return array into a sane hash map.
Definition: FacetBuilderVisitor.php:62
eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder
Definition: ContentTypeFacetBuilder.php:7
eZ\Publish\API\Repository\Values\Content\Search\Facet
Definition: ContentTypeFacet.php:7
eZ\Publish\Core\Search\Elasticsearch\Content\FacetBuilderVisitor
Definition: Search/Elasticsearch/Content/FacetBuilderVisitor/Aggregate.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.