PHP Class eZ\Publish\Core\Search\Legacy\Content\Handler

The basic idea of this class is to do the following: 1) The find methods retrieve a recursive set of filters, which define which content objects to retrieve from the database. Those may be combined using boolean operators. 2) This recursive criterion definition is visited into a query, which limits the content retrieved from the database. We might not be able to create sensible queries from all criterion definitions. 3) The query might be possible to optimize (remove empty statements), reduce singular and and or constructs… 4) Additionally we might need a post-query filtering step, which filters content objects based on criteria, which could not be converted in to database statements.
Inheritance: implements eZ\Publish\SPI\Search\Handler
显示文件 Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$contentMapper eZ\Publish\Core\Persistence\Legacy\Content\Mapper Content mapper.
$gateway Gateway Content locator gateway.
$indexerGateway eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway Word indexer gateway.
$languageHandler eZ\Publish\SPI\Persistence\Content\Language\Handler Language handler.
$locationGateway eZ\Publish\Core\Search\Legacy\Content\Location\Gateway Location locator gateway.
$locationMapper eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper Location locationMapper.
$mapper eZ\Publish\Core\Search\Legacy\Content\Mapper\FullTextMapper FullText mapper.

Public Methods

Method Description
__construct ( Gateway $gateway, Gateway $locationGateway, Gateway $indexerGateway, Mapper $contentMapper, Mapper $locationMapper, eZ\Publish\SPI\Persistence\Content\Language\Handler $languageHandler, FullTextMapper $mapper ) Creates a new content handler.
bulkIndex ( array $contentList, callable $errorCallback ) Bulk index list of content objects.
commit ( boolean $flush = false ) Commits the data to the index, making it available for search.
deleteContent ( integer $contentId, integer | null $versionId = null ) Deletes a content object from the index.
deleteLocation ( mixed $locationId, mixed $contentId ) Deletes a location from the index.
findContent ( eZ\Publish\API\Repository\Values\Content\Query $query, array $languageFilter = [] ) : eZ\Publish\API\Repository\Values\Content\Search\SearchResult Finds content objects for the given query.
findLocations ( eZ\Publish\API\Repository\Values\Content\LocationQuery $query, array $languageFilter = [] )
findSingle ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter, array $languageFilter = [] ) : eZ\Publish\SPI\Persistence\Content\ContentInfo Performs a query for a single content object.
indexContent ( eZ\Publish\SPI\Persistence\Content $content ) Indexes a content object.
indexLocation ( eZ\Publish\SPI\Persistence\Content\Location $location )
purgeIndex ( ) Purges all contents from the index.
suggest ( string $prefix, string[] $fieldPaths = [], integer $limit = 10, eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter = null ) Suggests a list of values for the given prefix.

Protected Methods

Method Description
extractMatchedLanguage ( $languageMask, $mainLanguageId, $languageSettings )

Method Details

__construct() public method

Creates a new content handler.
public __construct ( Gateway $gateway, Gateway $locationGateway, Gateway $indexerGateway, Mapper $contentMapper, Mapper $locationMapper, eZ\Publish\SPI\Persistence\Content\Language\Handler $languageHandler, FullTextMapper $mapper )
$gateway Gateway
$locationGateway eZ\Publish\Core\Search\Legacy\Content\Location\Gateway
$indexerGateway eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway
$contentMapper eZ\Publish\Core\Persistence\Legacy\Content\Mapper
$locationMapper eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper
$languageHandler eZ\Publish\SPI\Persistence\Content\Language\Handler
$mapper eZ\Publish\Core\Search\Legacy\Content\Mapper\FullTextMapper

bulkIndex() public method

Bulk index list of content objects.
public bulkIndex ( array $contentList, callable $errorCallback )
$contentList array
$errorCallback callable (Content $content, NotFoundException $e)

commit() public method

Commits the data to the index, making it available for search.
public commit ( boolean $flush = false )
$flush boolean

deleteContent() public method

Deletes a content object from the index.
public deleteContent ( integer $contentId, integer | null $versionId = null )
$contentId integer
$versionId integer | null

deleteLocation() public method

Deletes a location from the index.
public deleteLocation ( mixed $locationId, mixed $contentId )
$locationId mixed
$contentId mixed

extractMatchedLanguage() protected method

protected extractMatchedLanguage ( $languageMask, $mainLanguageId, $languageSettings )

findContent() public method

Finds content objects for the given query.
public findContent ( eZ\Publish\API\Repository\Values\Content\Query $query, array $languageFilter = [] ) : eZ\Publish\API\Repository\Values\Content\Search\SearchResult
$query eZ\Publish\API\Repository\Values\Content\Query
$languageFilter array - a map of language related filters specifying languages query will be performed on. Also used to define which field languages are loaded for the returned content. Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) useAlwaysAvailable defaults to true to avoid exceptions on missing translations
return eZ\Publish\API\Repository\Values\Content\Search\SearchResult

findLocations() public method

See also: eZ\Publish\SPI\Search\Handler::findLocations
public findLocations ( eZ\Publish\API\Repository\Values\Content\LocationQuery $query, array $languageFilter = [] )
$query eZ\Publish\API\Repository\Values\Content\LocationQuery
$languageFilter array

findSingle() public method

Performs a query for a single content object.
public findSingle ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter, array $languageFilter = [] ) : eZ\Publish\SPI\Persistence\Content\ContentInfo
$filter eZ\Publish\API\Repository\Values\Content\Query\Criterion
$languageFilter array - a map of language related filters specifying languages query will be performed on. Also used to define which field languages are loaded for the returned content. Currently supports: array("languages" => array(,..), "useAlwaysAvailable" => bool) useAlwaysAvailable defaults to true to avoid exceptions on missing translations
return eZ\Publish\SPI\Persistence\Content\ContentInfo

indexContent() public method

Indexes a content object.
public indexContent ( eZ\Publish\SPI\Persistence\Content $content )
$content eZ\Publish\SPI\Persistence\Content

indexLocation() public method

public indexLocation ( eZ\Publish\SPI\Persistence\Content\Location $location )
$location eZ\Publish\SPI\Persistence\Content\Location

purgeIndex() public method

Purges all contents from the index.
public purgeIndex ( )

suggest() public method

Suggests a list of values for the given prefix.
public suggest ( string $prefix, string[] $fieldPaths = [], integer $limit = 10, eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter = null )
$prefix string
$fieldPaths string[]
$limit integer
$filter eZ\Publish\API\Repository\Values\Content\Query\Criterion

Property Details

$contentMapper protected_oe property

Content mapper.
protected Mapper,eZ\Publish\Core\Persistence\Legacy\Content $contentMapper
return eZ\Publish\Core\Persistence\Legacy\Content\Mapper

$gateway protected_oe property

Content locator gateway.
protected Gateway,eZ\Publish\Core\Search\Legacy\Content $gateway
return Gateway

$indexerGateway protected_oe property

Word indexer gateway.
protected Gateway,eZ\Publish\Core\Search\Legacy\Content\WordIndexer $indexerGateway
return eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway

$languageHandler protected_oe property

Language handler.
protected Handler,eZ\Publish\SPI\Persistence\Content\Language $languageHandler
return eZ\Publish\SPI\Persistence\Content\Language\Handler

$locationGateway protected_oe property

Location locator gateway.
protected Gateway,eZ\Publish\Core\Search\Legacy\Content\Location $locationGateway
return eZ\Publish\Core\Search\Legacy\Content\Location\Gateway

$locationMapper protected_oe property

Location locationMapper.
protected Mapper,eZ\Publish\Core\Persistence\Legacy\Content\Location $locationMapper
return eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper

$mapper protected_oe property

FullText mapper.
protected FullTextMapper,eZ\Publish\Core\Search\Legacy\Content\Mapper $mapper
return eZ\Publish\Core\Search\Legacy\Content\Mapper\FullTextMapper