PHP Class eZ\Publish\Core\Search\Common\FieldNameGenerator

Show file Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$fieldNameMapping array We implement this mapping, because those dynamic fields are common to search backend configurations.

Public Methods

Method Description
__construct ( array $fieldNameMapping )
getName ( string $name, null | string $field = null, null | string $type = null ) : string Get name for document field.
getTypedName ( string $name, eZ\Publish\SPI\Search\FieldType $type ) : string Map field type.

Method Details

__construct() public method

public __construct ( array $fieldNameMapping )
$fieldNameMapping array

getName() public method

Consists of a name, and optionally field name and a content type name.
public getName ( string $name, null | string $field = null, null | string $type = null ) : string
$name string
$field null | string
$type null | string
return string

getTypedName() public method

For indexing backend the following scheme will always be used for names: {name}_{type}. Using dynamic fields this allows to define fields either depending on types, or names. Only the field with the name 'id' remains untouched.
public getTypedName ( string $name, eZ\Publish\SPI\Search\FieldType $type ) : string
$name string
$type eZ\Publish\SPI\Search\FieldType
return string

Property Details

$fieldNameMapping protected property

We implement this mapping, because those dynamic fields are common to search backend configurations.
See also: eZ\Publish\SPI\Search\FieldType Code example: array( "ez_integer" => "i", "ez_string" => "s", ... )
protected array $fieldNameMapping
return array