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

ImageAsset/SearchField.php
Go to the documentation of this file.
1 <?php
2
7 declare(strict_types=1);
8
9 namespace eZ\Publish\Core\FieldType\ImageAsset;
10
11 use eZ\Publish\SPI\Persistence\Content\Field;
12 use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
13 use eZ\Publish\SPI\FieldType\Indexable;
14 use eZ\Publish\SPI\Search;
15
19 class SearchField implements Indexable
20 {
29 public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array
30 {
31 return [
32 new Search\Field(
33 'value',
34 reset($field->value->data),
35 new Search\FieldType\StringField()
36 ),
37 ];
38 }
39
45 public function getIndexDefinition(): array
46 {
47 return [
48 'value' => new Search\FieldType\StringField(),
49 ];
50 }
51
61 public function getDefaultMatchField(): string
62 {
63 return 'value';
64 }
65
75 public function getDefaultSortField(): string
76 {
77 return $this->getDefaultMatchField();
78 }
79 }
eZ\Publish\API\Repository\Values\ContentType\FieldDefinition
Definition: API/Repository/Values/ContentType/FieldDefinition.php:31
eZ\Publish\API\Repository\Values\Content\Field
Definition: API/Repository/Values/Content/Field.php:21
eZ\Publish\Core\FieldType\FieldType
Base class for field types, the most basic storage unit of data inside eZ Publish.
Definition: Core/FieldType/FieldType.php:35
eZ\Publish\Core\FieldType\ImageAsset\SearchField
Indexable definition for Image Asset field type.
Definition: ImageAsset/SearchField.php:20
eZ\Publish\Core\FieldType\ImageAsset\SearchField\getDefaultMatchField
getDefaultMatchField()
Get name of the default field to be used for matching.
Definition: ImageAsset/SearchField.php:61
eZ\Publish\Core\FieldType\ImageAsset\SearchField\getIndexData
getIndexData(Field $field, FieldDefinition $fieldDefinition)
Get index data for field for search backend.
Definition: ImageAsset/SearchField.php:29
eZ\Publish\Core\FieldType\ImageAsset\SearchField\getDefaultSortField
getDefaultSortField()
Get name of the default field to be used for sorting.
Definition: ImageAsset/SearchField.php:75
eZ\Publish\Core\FieldType\ImageAsset\SearchField\getIndexDefinition
getIndexDefinition()
Get index field types for search backend.
Definition: ImageAsset/SearchField.php:45
eZ\Publish\SPI\Persistence\Content\Field
Definition: SPI/Persistence/Content/Field.php:12
eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
Definition: SPI/Persistence/Content/Type/FieldDefinition.php:18
eZ\Publish\SPI\FieldType\Indexable
The field type interface which all field types have to implement to be indexable by search backends.
Definition: Indexable.php:17
eZ\Publish\Core\FieldType\ImageAsset
Definition: AssetMapper.php:9
eZ\Publish\SPI\Search
Definition: Capable.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.