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

RelationList/SearchField.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\RelationList;
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 'value',
32 $field->value->data['destinationContentIds'],
33 new Search\FieldType\MultipleStringField()
34 ),
35 new Search\Field(
36 'sort_value',
37 implode('-', $field->value->data['destinationContentIds']),
38 new Search\FieldType\StringField()
39 ),
40 ];
41 }
42
48 public function getIndexDefinition()
49 {
50 return [
51 'value' => new Search\FieldType\MultipleStringField(),
52 'sort_value' => new Search\FieldType\StringField(),
53 ];
54 }
55
65 public function getDefaultMatchField()
66 {
67 return 'value';
68 }
69
79 public function getDefaultSortField()
80 {
81 return 'sort_value';
82 }
83 }
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\RelationList\SearchField
Indexable definition for RelationList field type.
Definition: RelationList/SearchField.php:18
eZ\Publish\Core\FieldType\RelationList\SearchField\getIndexData
getIndexData(Field $field, FieldDefinition $fieldDefinition)
Get index data for field for search backend.
Definition: RelationList/SearchField.php:27
eZ\Publish\Core\FieldType\RelationList\SearchField\getIndexDefinition
getIndexDefinition()
Get index field types for search backend.
Definition: RelationList/SearchField.php:48
eZ\Publish\Core\FieldType\RelationList\SearchField\getDefaultMatchField
getDefaultMatchField()
Get name of the default field to be used for matching.
Definition: RelationList/SearchField.php:65
eZ\Publish\Core\FieldType\RelationList\SearchField\getDefaultSortField
getDefaultSortField()
Get name of the default field to be used for sorting.
Definition: RelationList/SearchField.php:79
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\RelationList
Definition: RelationList/NameableField.php:7
eZ\Publish\SPI\Search
Definition: Capable.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.