Get index data for field for search backend.

@param \eZ\Publish\SPI\Persistence\Content\Field $field
@param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition

@return \eZ\Publish\SPI\Search\Field[]
422507
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                reset($field->value->data),
                new Search\FieldType\StringField()
            ),
        );
    }
685222
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'file_name',
                $field->value->externalData['fileName'],
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'file_size',
                $field->value->externalData['fileSize'],
                new Search\FieldType\IntegerField()
            ),
            new Search\Field(
                'mime_type',
                $field->value->externalData['mimeType'],
                new Search\FieldType\StringField()
            ),
        );
    }
307176
public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
    {
        if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minIntegerValue'])) {
            $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minIntegerValue'];
        }
        if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxIntegerValue'])) {
            $storageDef->dataInt2 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxIntegerValue'];
        }

        if ($storageDef->dataInt1 === false || $storageDef->dataInt2 === false) {
            @trigger_error(
                "The IntegerValueValidator constraint value 'false' is deprecated, and will be removed in 7.0. Use 'null' instead.",
                E_USER_DEPRECATED
            );
            $storageDef->dataInt1 = $storageDef->dataInt1 === false ? null : $storageDef->dataInt1;
            $storageDef->dataInt2 = $storageDef->dataInt2 === false ? null : $storageDef->dataInt2;
        }

        // Defining dataInt4 which holds the validator state (min value/max value/minMax value)
        $storageDef->dataInt4 = $this->getStorageDefValidatorState($storageDef->dataInt1, $storageDef->dataInt2);
        $storageDef->dataInt3 = $fieldDef->defaultValue->data;
    }
814187
public function toStorageFieldDefinition( FieldDefinition $fieldDef, StorageFieldDefinition $storageDef )
    {
        $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings;

        if (isset($fieldSettings['configuration'])) {
            $storageDef->dataText5 = json_encode($fieldSettings['configuration']);
        }
    }
1249067
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value_address',
                $field->value->externalData['address'],
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'value_location',
                array(
                    'latitude' => $field->value->externalData['latitude'],
                    'longitude' => $field->value->externalData['longitude'],
                ),
                new Search\FieldType\GeoLocationField()
            ),
            new Search\Field(
                'fulltext',
                $field->value->externalData['address'],
                new Search\FieldType\FullTextField()
            ),
        );
    }
663529
public FieldDefinition getField(int index) {
        if (index >= fields.size() || index < 0) {
            return null;
        }
        Iterator<FieldDefinition> iter = fields.values().iterator();
        for (int j = 0; j < index ; j++) {
            iter.next();
        }
        return iter.next();
    }
1214615
public function getFieldDefsByType($fieldDef)
    {
        if (is_string($fieldDef)) {
            $fieldDef = array('type' => $fieldDef);
        }

        if (isset($fieldDef['type'])) {
            return $this->getMetadata()->get('fields.'.$fieldDef['type']);
        }

        return null;
    }
280096
private function resolveNewFieldDefinitionIdentifier(
        ContentTypeDraft $contentTypeDraft,
        int $startIndex,
        string $fieldTypeIdentifier
    ): string {
        $fieldDefinitionIdentifiers = array_map(function (FieldDefinition $fieldDefinition) {
            return $fieldDefinition->identifier;
        }, $contentTypeDraft->getFieldDefinitions());

        do {
            $fieldDefinitionIdentifier = sprintf('new_%s_%d', $fieldTypeIdentifier, ++$startIndex);
        } while (in_array($fieldDefinitionIdentifier, $fieldDefinitionIdentifiers, true));

        return $fieldDefinitionIdentifier;
    }
436571
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings(
            array(
                'defaultType' => $storageDef->dataInt1,
            )
        );

        // Building default value
        switch ($fieldDef->fieldTypeConstraints->fieldSettings['defaultType']) {
            case DateType::DEFAULT_CURRENT_DATE:
                $data = array(
                    'timestamp' => time(), // @deprecated timestamp is no longer used and will be removed in a future version.
                    'rfc850' => null,
                    'timestring' => 'now',
                );
                break;
            default:
                $data = null;
        }

        $fieldDef->defaultValue->data = $data;
    }
918194
public function getAssetFieldDefinition(): FieldDefinition
    {
        $contentType = $this->contentTypeService->loadContentTypeByIdentifier(
            $this->mappings['content_type_identifier']
        );

        return $contentType->getFieldDefinition(
            $this->mappings['content_field_identifier']
        );
    }
557706
public function getFieldDefinitions()
    {
        $fieldDefinitions = array();
        foreach ($this->fieldDefinitionReferences as $reference) {
            $fieldDefinitions[] = $this->contentTypeService->loadFieldDefinition($reference);
        }

        return $fieldDefinitions;
    }
804648
protected function generateFieldSql( $fieldName, ezcDbSchemaField $fieldDefinition )
    {
        $sqlDefinition = "'$fieldName' ";
        $defList = array();

        $type = $this->convertFromGenericType( $fieldDefinition );
        $defList[] = $type;

        if ( $fieldDefinition->notNull )
        {
            $defList[] = 'NOT NULL';
        }

        if ( $fieldDefinition->autoIncrement )
        {
            $defList[] = "PRIMARY KEY AUTOINCREMENT";
            $this->context['skip_primary'] = true;
        }
        
        if ( !is_null( $fieldDefinition->default ) && !$fieldDefinition->autoIncrement )
        {
            $default = $this->generateDefault( $fieldDefinition->type, $fieldDefinition->default );
            $defList[] = "DEFAULT $default";
        }

        $sqlDefinition .= join( ' ', $defList );

        return $sqlDefinition;
    }
1029205
public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
    {
        if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minFloatValue'])) {
            $storageDef->dataFloat1 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minFloatValue'];
        }

        if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxFloatValue'])) {
            $storageDef->dataFloat2 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxFloatValue'];
        }

        // Defining dataFloat4 which holds the validator state (min value/max value)
        $storageDef->dataFloat4 = $this->getStorageDefValidatorState($storageDef->dataFloat1, $storageDef->dataFloat2);
        $storageDef->dataFloat3 = $fieldDef->defaultValue->data;
    }
619341
public function toFieldDefinition(
        StorageFieldDefinition $storageFieldDef,
        FieldDefinition $fieldDef
    ) {
        $converter = $this->converterRegistry->getConverter(
            $fieldDef->fieldType
        );
        $converter->toFieldDefinition(
            $storageFieldDef,
            $fieldDef
        );
    }
1241693
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        $document = new DOMDocument();
        $document->loadXML($field->value->data);

        return array(
            new Search\Field(
                'value',
                self::extractShortText($document),
                new Search\FieldType\StringField()
            ),
            new Search\Field(
                'fulltext',
                $this->extractText($document->documentElement),
                new Search\FieldType\FullTextField()
            ),
        );
    }
1185954
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $validatorParameters = array('minIntegerValue' => null, 'maxIntegerValue' => null);
        if ($storageDef->dataInt4 & self::HAS_MIN_VALUE) {
            $validatorParameters['minIntegerValue'] = $storageDef->dataInt1;
        }

        if ($storageDef->dataInt4 & self::HAS_MAX_VALUE) {
            $validatorParameters['maxIntegerValue'] = $storageDef->dataInt2;
        }
        $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER] = $validatorParameters;
        $fieldDef->defaultValue->data = $storageDef->dataInt3;
        $fieldDef->defaultValue->sortKey = ($storageDef->dataInt3 === null ? 0 : $storageDef->dataInt3);
    }
1078173
private function getDefaultSearchFields(array $fieldDescriptors): array
    {
        $defaultSearchFields = [];
        foreach ($fieldDescriptors as $fieldDescriptor) {
            if (FieldDescriptorInterface::SEARCHABILITY_YES === $fieldDescriptor->getSearchability()) {
                $defaultSearchFields[] = $fieldDescriptor->getName();
            }
        }

        return $defaultSearchFields;
    }