eZPublishCommunityProject  2012.12
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler Class Reference

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

+ Inheritance diagram for eZ\Publish\Core\Persistence\Solr\Content\Search\Handler:
+ Collaboration diagram for eZ\Publish\Core\Persistence\Solr\Content\Search\Handler:

Public Member Functions

 __construct (Gateway $gateway, FieldRegistry $fieldRegistry, ContentTypeHandler $contentTypeHandler, ObjectStateHandler $objectStateHandler)
 Creates a new content handler. More...
 
 findContent (Query $query, array $fieldFilters=array())
 Finds content objects for the given query. More...
 
 findSingle (Criterion $criterion, array $fieldFilters=array())
 Performs a query for a single content object. More...
 
 indexContent (Content $content)
 Indexes a content object. More...
 
 purgeIndex ()
 Purges all contents from the index. More...
 
 suggest ($prefix, $fieldPaths=array(), $limit=10, Criterion $filter=null)
 Suggests a list of values for the given prefix. More...
 
- Public Member Functions inherited from eZ\Publish\SPI\Persistence\Content\Search\Handler
 findContent (Query $query, array $fieldFilters=array())
 Finds content objects for the given query. More...
 
 findSingle (Criterion $criterion, array $fieldFilters=array())
 Performs a query for a single content object. More...
 
 indexContent (Content $content)
 Indexes a content object. More...
 
 suggest ($prefix, $fieldPaths=array(), $limit=10, Criterion $filter=null)
 Suggests a list of values for the given prefix. More...
 

Protected Member Functions

 mapContent (Content $content)
 Map content to document. More...
 

Protected Attributes

 $contentTypeHandler
 
 $fieldRegistry
 
 $gateway
 
 $objectStateHandler
 

Detailed Description

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.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::__construct ( Gateway  $gateway,
FieldRegistry  $fieldRegistry,
ContentTypeHandler  $contentTypeHandler,
ObjectStateHandler  $objectStateHandler 
)

Creates a new content handler.

Parameters
\eZ\Publish\Core\Persistence\Solr\Content\Search\Gateway$gateway
\eZ\Publish\Core\Persistence\Solr\Content\Search\FieldRegistry$fieldRegistry
\eZ\Publish\SPI\Persistence\Content\Type\Handler$contentTypeHandler
\eZ\Publish\SPI\Persistence\Content\ObjectState\Handler$objectStateHandler

Member Function Documentation

eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::findContent ( Query  $query,
array  $fieldFilters = array() 
)

Finds content objects for the given query.

Todo:
define structs for the field filters
Parameters
\eZ\Publish\API\Repository\Values\Content\Query$query
array$fieldFilters- a map of filters for the returned fields. Currently supported: array("languages" => array(<language1>,..)).
Returns

Referenced by eZ\Publish\Core\Persistence\Solr\Content\Search\Handler\findSingle().

eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::findSingle ( Criterion  $criterion,
array  $fieldFilters = array() 
)

Performs a query for a single content object.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the object was not found by the query or due to permissions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif there is more than than one result matching the criterions
Todo:
define structs for the field filters
Parameters
\eZ\Publish\API\Repository\Values\Content\Query\Criterion$criterion
array$fieldFilters- a map of filters for the returned fields. Currently supported: array("languages" => array(<language1>,..)).
Returns
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::indexContent ( Content  $content)

Indexes a content object.

Parameters
\eZ\Publish\SPI\Persistence\Content$content
Returns
void
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::mapContent ( Content  $content)
protected

Map content to document.

A document is an array of fields

Parameters
Content$content
Returns
array

Referenced by eZ\Publish\Core\Persistence\Solr\Content\Search\Handler\indexContent().

eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::purgeIndex ( )

Purges all contents from the index.

Todo:
: Make this public API?
Returns
void
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::suggest (   $prefix,
  $fieldPaths = array(),
  $limit = 10,
Criterion  $filter = null 
)

Suggests a list of values for the given prefix.

Parameters
string$prefix
string[]$fieldPaths
int$limit
\eZ\Publish\API\Repository\Values\Content\Query\Criterion$filter

Member Data Documentation

eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::$contentTypeHandler
protected
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::$fieldRegistry
protected
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::$gateway
protected
eZ\Publish\Core\Persistence\Solr\Content\Search\Handler::$objectStateHandler
protected

The documentation for this class was generated from the following file: