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

Image/SearchField.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\Image;
8
9 use eZ\Publish\SPI\Persistence\Content\Field;
10 use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
11 use eZ\Publish\SPI\FieldType\Indexable;
12 use eZ\Publish\SPI\Search;
13
17 class SearchField implements Indexable
18 {
27 public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
28 {
29 return [
30 new Search\Field(
31 'filename',
32 $field->value->data['fileName'] ?? null,
33 new Search\FieldType\StringField()
34 ),
35 new Search\Field(
36 'alternative_text',
37 $field->value->data['alternativeText'] ?? null,
38 new Search\FieldType\StringField()
39 ),
40 new Search\Field(
41 'file_size',
42 $field->value->data['fileSize'] ?? null,
43 new Search\FieldType\IntegerField()
44 ),
45 new Search\Field(
46 'mime_type',
47 $field->value->data['mime'] ?? null,
48 new Search\FieldType\StringField()
49 ),
50 ];
51 }
52
58 public function getIndexDefinition()
59 {
60 return [
61 'filename' => new Search\FieldType\StringField(),
62 'alternative_text' => new Search\FieldType\StringField(),
63 'file_size' => new Search\FieldType\IntegerField(),
64 'mime_type' => new Search\FieldType\StringField(),
65 ];
66 }
67
77 public function getDefaultMatchField()
78 {
79 return 'filename';
80 }
81
91 public function getDefaultSortField()
92 {
93 return $this->getDefaultMatchField();
94 }
95 }
eZ\Publish\API\Repository\Values\ContentType\FieldDefinition
Definition: API/Repository/Values/ContentType/FieldDefinition.php:31
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\Image\SearchField
Indexable definition for TextLine field type.
Definition: Image/SearchField.php:18
eZ\Publish\Core\FieldType\Image\SearchField\getIndexData
getIndexData(Field $field, FieldDefinition $fieldDefinition)
Get index data for field for search backend.
Definition: Image/SearchField.php:27
eZ\Publish\Core\FieldType\Image\SearchField\getDefaultMatchField
getDefaultMatchField()
Get name of the default field to be used for matching.
Definition: Image/SearchField.php:77
eZ\Publish\Core\FieldType\Image\SearchField\getDefaultSortField
getDefaultSortField()
Get name of the default field to be used for sorting.
Definition: Image/SearchField.php:91
eZ\Publish\Core\FieldType\Image\SearchField\getIndexDefinition
getIndexDefinition()
Get index field types for search backend.
Definition: Image/SearchField.php:58
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\Image
Definition: AliasCleanerInterface.php:7
eZ\Publish\SPI\Search
Definition: Capable.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.