Class

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

class Handler implements Handler

The Content Search handler retrieves sets of of Content objects, based on a set of criteria.

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.

Methods

__construct(Gateway $gateway, Gateway $locationGateway, Gateway $indexerGateway, Mapper $contentMapper, Mapper $locationMapper, Handler $languageHandler, FullTextMapper $mapper)

Creates a new content handler.

SearchResult findContent(Query $query, array $languageFilter = array())

Finds content objects for the given query.

ContentInfo findSingle(Criterion $filter, array $languageFilter = array())

Performs a query for a single content object.

SearchResult findLocations(LocationQuery $query, array $languageFilter = array())

suggest(string $prefix, string[] $fieldPaths = array(), int $limit = 10, Criterion $filter = null)

Suggests a list of values for the given prefix.

indexContent(Content $content)

Indexes a content object.

bulkIndex(array $contentList, callable $errorCallback)

Bulk index list of content objects.

indexLocation(Location $location)

deleteContent(int $contentId, int|null $versionId = null)

Deletes a content object from the index.

deleteLocation(mixed $locationId, mixed $contentId)

Deletes a location from the index.

purgeIndex()

Purges all contents from the index.

commit(bool $flush = false)

Commits the data to the index, making it available for search.

Details

at line 112
public __construct(Gateway $gateway, Gateway $locationGateway, Gateway $indexerGateway, Mapper $contentMapper, Mapper $locationMapper, Handler $languageHandler, FullTextMapper $mapper)

Creates a new content handler.

Parameters

Gateway $gateway
Gateway $locationGateway
Gateway $indexerGateway
Mapper $contentMapper
Mapper $locationMapper
Handler $languageHandler
FullTextMapper $mapper

at line 143
public SearchResult findContent(Query $query, array $languageFilter = array())

Finds content objects for the given query.

Parameters

Query $query
array $languageFilter
  • 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 Value

SearchResult With ContentInfo as SearchHit->valueObject

Exceptions

InvalidArgumentException if Query criterion is not applicable to its target

at line 224
public ContentInfo findSingle(Criterion $filter, array $languageFilter = array())

Performs a query for a single content object.

Parameters

Criterion $filter
array $languageFilter
  • 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 Value

ContentInfo

Exceptions

NotFoundException if the object was not found by the query or due to permissions
InvalidArgumentException if Criterion is not applicable to its target
InvalidArgumentException if there is more than than one result matching the criterions

at line 257
public SearchResult findLocations(LocationQuery $query, array $languageFilter = array())

Parameters

LocationQuery $query
array $languageFilter
  • 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 Value

SearchResult With Location as SearchHit->valueObject

See also

\eZ\Publish\SPI\Search\Handler::findLocations

at line 311
public suggest(string $prefix, string[] $fieldPaths = array(), int $limit = 10, Criterion $filter = null)

Suggests a list of values for the given prefix.

Parameters

string $prefix
string[] $fieldPaths
int $limit
Criterion $filter

Exceptions

NotImplementedException

at line 321
public indexContent(Content $content)

Indexes a content object.

Parameters

Content $content

at line 334
public bulkIndex(array $contentList, callable $errorCallback)

Bulk index list of content objects.

Parameters

array $contentList
callable $errorCallback (Content $content, NotFoundException $e)

at line 351
public indexLocation(Location $location)

Parameters

Location $location

at line 362
public deleteContent(int $contentId, int|null $versionId = null)

Deletes a content object from the index.

Parameters

int $contentId
int|null $versionId

at line 373
public deleteLocation(mixed $locationId, mixed $contentId)

Deletes a location from the index.

Parameters

mixed $locationId
mixed $contentId

at line 381
public purgeIndex()

Purges all contents from the index.

at line 391
public commit(bool $flush = false)

Commits the data to the index, making it available for search.

Parameters

bool $flush