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

CriterionVisitor/DateMetadata/ModifiedRange.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata;
8
9 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitorDispatcher as Dispatcher;
10 use eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata;
11 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12 use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator;
13
17 class ModifiedRange extends DateMetadata
18 {
26 public function canVisit(Criterion $criterion)
27 {
28 return
29 $criterion instanceof Criterion\DateMetadata &&
30 $criterion->target === 'modified' &&
31 (
32 $criterion->operator === Operator::LT ||
33 $criterion->operator === Operator::LTE ||
34 $criterion->operator === Operator::GT ||
35 $criterion->operator === Operator::GTE ||
36 $criterion->operator === Operator::BETWEEN
37 );
38 }
39
49 public function visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
50 {
51 $start = $this->getNativeTime($criterion->value[0]);
52 $end = isset($criterion->value[1]) ? $this->getNativeTime($criterion->value[1]) : null;
53
54 return [
55 'range' => [
56 'modified_dt' => $this->getFilterRange($criterion->operator, $start, $end),
57 ],
58 ];
59 }
60 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\DateMetadata
A criterion that matches content based on one of the date metadata (created or modified).
Definition: API/Repository/Values/Content/Query/Criterion/DateMetadata.php:32
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\LT
const LT
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:19
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\LTE
const LTE
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:20
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\GT
const GT
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:17
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\BETWEEN
const BETWEEN
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:22
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\GTE
const GTE
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:18
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\DateMetadata\ModifiedRange
Visits the ModifiedRange DateMetadata criterion.
Definition: CriterionVisitor/DateMetadata/ModifiedRange.php:18
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\ModifiedRange\canVisit
canVisit(Criterion $criterion)
Check if visitor is applicable to current criterion.
Definition: CriterionVisitor/DateMetadata/ModifiedRange.php:26
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\ModifiedRange\visitFilter
visitFilter(Criterion $criterion, Dispatcher $dispatcher, array $languageFilter)
Map field value to a proper Elasticsearch filter representation.
Definition: CriterionVisitor/DateMetadata/ModifiedRange.php:49
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata\getNativeTime
getNativeTime($value)
Map value to a proper Elasticsearch date representation.
Definition: Core/Search/Elasticsearch/Content/CriterionVisitor/DateMetadata.php:26
eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\getFilterRange
getFilterRange($operator, $start, $end)
Get Elasticsearch range filter.
Definition: CriterionVisitor.php:141
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\DateMetadata
Definition: CriterionVisitor/DateMetadata/ModifiedIn.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.