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

Show file Open project: ezsystems/ezpublish-kernel

Public Methods

Method Description
canVisit ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion ) : boolean Check if visitor is applicable to current criterion.
visitFilter ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion, CriterionVisitorDispatcher $dispatcher, array $languageFilter ) : mixed Map field value to a proper Elasticsearch filter representation.
visitQuery ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion, CriterionVisitorDispatcher $dispatcher, array $languageFilter ) : mixed Map field value to a proper Elasticsearch query representation.

Protected Methods

Method Description
getFilterRange ( mixed $operator, mixed $start, mixed $end ) : string Get Elasticsearch range filter.
getQueryRange ( mixed $operator, mixed $start, mixed $end ) : string Get Elasticsearch range query.
prepareValue ( mixed $value ) : string Converts given $value to the appropriate Elasticsearch representation.

Method Details

canVisit() abstract public method

Check if visitor is applicable to current criterion.
abstract public canVisit ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion ) : boolean
$criterion eZ\Publish\API\Repository\Values\Content\Query\Criterion
return boolean

getFilterRange() protected method

Start and end are optional, depending on the respective operator. Pass null in this case. The operator may be one of: - case Operator::GT: - case Operator::GTE: - case Operator::LT: - case Operator::LTE: - case Operator::BETWEEN:
protected getFilterRange ( mixed $operator, mixed $start, mixed $end ) : string
$operator mixed
$start mixed
$end mixed
return string

getQueryRange() protected method

Start and end are optional, depending on the respective operator. Pass null in this case. The operator may be one of: - case Operator::GT: - case Operator::GTE: - case Operator::LT: - case Operator::LTE: - case Operator::BETWEEN:
protected getQueryRange ( mixed $operator, mixed $start, mixed $end ) : string
$operator mixed
$start mixed
$end mixed
return string

prepareValue() protected method

The value will be converted to string representation and escaped if needed.
protected prepareValue ( mixed $value ) : string
$value mixed
return string

visitFilter() abstract public method

Map field value to a proper Elasticsearch filter representation.
abstract public visitFilter ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion, CriterionVisitorDispatcher $dispatcher, array $languageFilter ) : mixed
$criterion eZ\Publish\API\Repository\Values\Content\Query\Criterion
$dispatcher CriterionVisitorDispatcher
$languageFilter array
return mixed Hash representation of Elasticsearch filter abstract syntax tree

visitQuery() public method

By default this method fallbacks on {@link self::visitFilter()}, override it as needed.
public visitQuery ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion, CriterionVisitorDispatcher $dispatcher, array $languageFilter ) : mixed
$criterion eZ\Publish\API\Repository\Values\Content\Query\Criterion
$dispatcher CriterionVisitorDispatcher
$languageFilter array
return mixed Hash representation of Elasticsearch query abstract syntax tree