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

Keyword/SearchField.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\Keyword;
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 {
19 public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
20 {
21 return [
22 new Search\Field(
23 'value',
24 $field->value->externalData,
25 new Search\FieldType\MultipleStringField()
26 ),
27 new Search\Field(
28 'sort_value',
29 implode(' ', $field->value->externalData),
30 new Search\FieldType\StringField()
31 ),
32 new Search\Field(
33 'fulltext',
34 $field->value->externalData,
35 new Search\FieldType\FullTextField()
36 ),
37 ];
38 }
39
40 public function getIndexDefinition()
41 {
42 return [
43 'value' => new Search\FieldType\MultipleStringField(),
44 'sort_value' => new Search\FieldType\StringField(),
45 ];
46 }
47
48 public function getDefaultMatchField()
49 {
50 return 'value';
51 }
52
53 public function getDefaultSortField()
54 {
55 return 'sort_value';
56 }
57 }
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\Keyword\SearchField
Indexable definition for Keyword field type.
Definition: Keyword/SearchField.php:18
eZ\Publish\Core\FieldType\Keyword\SearchField\getDefaultSortField
getDefaultSortField()
Get name of the default field to be used for sorting.
Definition: Keyword/SearchField.php:53
eZ\Publish\Core\FieldType\Keyword\SearchField\getDefaultMatchField
getDefaultMatchField()
Get name of the default field to be used for matching.
Definition: Keyword/SearchField.php:48
eZ\Publish\Core\FieldType\Keyword\SearchField\getIndexData
getIndexData(Field $field, FieldDefinition $fieldDefinition)
Definition: Keyword/SearchField.php:19
eZ\Publish\Core\FieldType\Keyword\SearchField\getIndexDefinition
getIndexDefinition()
Get index field types for search backend.
Definition: Keyword/SearchField.php:40
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\SPI\Search
Definition: Capable.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.