PHP Class eZ\Publish\Core\Search\Elasticsearch\Content\Serializer

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

Protected Properties

Property Type Description
$fieldValueMapper eZ\Publish\Core\Search\Common\FieldValueMapper Field value mapper.
$nameGenerator eZ\Publish\Core\Search\Common\FieldNameGenerator Field name generator.

Public Methods

Method Description
__construct ( FieldValueMapper $fieldValueMapper, FieldNameGenerator $nameGenerator )
getIndexDocument ( Document $document ) : string Returns document _source that can be used for (bulk) indexing.
getIndexMetadata ( Document $document ) : string Returns bulk metadata for creating a new document or replacing an existing document.

Protected Methods

Method Description
getDocumentHash ( Document $document ) : array Converts given $document to a hash format that can be JSON encoded to get a document _source.

Method Details

__construct() public method

public __construct ( FieldValueMapper $fieldValueMapper, FieldNameGenerator $nameGenerator )
$fieldValueMapper eZ\Publish\Core\Search\Common\FieldValueMapper
$nameGenerator eZ\Publish\Core\Search\Common\FieldNameGenerator

getDocumentHash() protected method

Implemented in a separate method because of a recursion needed to handle nested documents.
protected getDocumentHash ( Document $document ) : array
$document Document
return array

getIndexDocument() public method

Returns document _source that can be used for (bulk) indexing.
public getIndexDocument ( Document $document ) : string
$document Document
return string

getIndexMetadata() public method

Note: _index parameter is omitted because it is configurable on a gateway and passed as a part of the REST resource in {@link \eZ\Publish\Core\Search\Elasticsearch\Content\Gateway::bulkIndex()}.
See also: eZ\Publish\Core\Search\Elasticsearch\Content\Gateway::bulkIndex()
public getIndexMetadata ( Document $document ) : string
$document Document
return string

Property Details

$fieldValueMapper protected property

Field value mapper.
protected FieldValueMapper,eZ\Publish\Core\Search\Common $fieldValueMapper
return eZ\Publish\Core\Search\Common\FieldValueMapper

$nameGenerator protected property

Field name generator.
protected FieldNameGenerator,eZ\Publish\Core\Search\Common $nameGenerator
return eZ\Publish\Core\Search\Common\FieldNameGenerator