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

MapLocation/SearchField.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\MapLocation;
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_address',
32 $field->value->externalData['address'] ?? null,
33 new Search\FieldType\StringField()
34 ),
35 new Search\Field(
36 'value_location',
37 [
38 'latitude' => $field->value->externalData['latitude'] ?? null,
39 'longitude' => $field->value->externalData['longitude'] ?? null,
40 ],
41 new Search\FieldType\GeoLocationField()
42 ),
43 new Search\Field(
44 'fulltext',
45 $field->value->externalData['address'] ?? null,
46 new Search\FieldType\FullTextField()
47 ),
48 ];
49 }
50
56 public function getIndexDefinition()
57 {
58 return [
59 'value_address' => new Search\FieldType\StringField(),
60 'value_location' => new Search\FieldType\GeoLocationField(),
61 ];
62 }
63
73 public function getDefaultMatchField()
74 {
75 return 'value_address';
76 }
77
87 public function getDefaultSortField()
88 {
89 return $this->getDefaultMatchField();
90 }
91 }
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\MapLocation\SearchField
Indexable definition for MapLocation field type.
Definition: MapLocation/SearchField.php:18
eZ\Publish\Core\FieldType\MapLocation\SearchField\getDefaultSortField
getDefaultSortField()
Get name of the default field to be used for sorting.
Definition: MapLocation/SearchField.php:87
eZ\Publish\Core\FieldType\MapLocation\SearchField\getIndexData
getIndexData(Field $field, FieldDefinition $fieldDefinition)
Get index data for field for search backend.
Definition: MapLocation/SearchField.php:27
eZ\Publish\Core\FieldType\MapLocation\SearchField\getIndexDefinition
getIndexDefinition()
Get index field types for search backend.
Definition: MapLocation/SearchField.php:56
eZ\Publish\Core\FieldType\MapLocation\SearchField\getDefaultMatchField
getDefaultMatchField()
Get name of the default field to be used for matching.
Definition: MapLocation/SearchField.php:73
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+.