PHP Class yii\sphinx\MatchBuilder

See also: MatchExpression
See also: http://sphinxsearch.com/docs/current.html#extended-syntax
Since: 2.0.6
Author: Kirichenko Sergey ([email protected])
Author: Paul Klimov ([email protected])
Inheritance: extends yii\base\Object
显示文件 Open project: yiisoft/yii2-sphinx

Public Properties

Property Type Description
$db the Sphinx connection.

Protected Properties

Property Type Description
$matchBuilders map of MATCH keywords to builder methods. These methods are used by [[buildMatch]] to build MATCH expression from array syntax.
$matchOperators map of MATCH operators. These operators are used for replacement of verbose operators.

Public Methods

Method Description
__construct ( Connection $connection, array $config = [] ) Constructor.
build ( MatchExpression $match ) : string Generates the MATCH expression from given MatchExpression object.
buildAndMatch ( string $operator, array $operands, array &$params ) : string Connects two or more MATCH expressions with the AND or OR operator
buildHashMatch ( array $match, array &$params ) : string Creates a MATCH based on column-value pairs.
buildIgnoreMatch ( string $operator, array $operands, &$params ) : string Create ignored MATCH expressions
buildMatch ( string | array $match, array &$params ) : string Create MATCH expression.
buildMultipleMatch ( string $operator, array $operands, &$params ) : string Create MAYBE, SENTENCE or PARAGRAPH expressions.
buildProximityMatch ( string $operator, array $operands, &$params ) : string Create PROXIMITY expressions
buildSimpleMatch ( string $operator, array $operands, array &$params ) : string Creates an Match expressions like "column" operator value.
buildZoneMatch ( string $operator, array $operands, &$params ) : string Create MATCH expressions for zones.

Protected Methods

Method Description
buildMatchColumn ( string $column, boolean $ignored = false ) : string Created column as string for expression of MATCH
buildMatchValue ( string | array | yii\db\Expression $value, array &$params ) : string Create placeholder for expression of MATCH
parseParams ( string $expression, array $params ) : string Returns the actual MATCH expression by inserting parameter values into the corresponding placeholders.

Method Details

__construct() public method

Constructor.
public __construct ( Connection $connection, array $config = [] )
$connection Connection the Sphinx connection.
$config array name-value pairs that will be used to initialize the object properties

build() public method

Generates the MATCH expression from given MatchExpression object.
public build ( MatchExpression $match ) : string
$match MatchExpression the [[MatchExpression]] object from which the MATCH expression will be generated.
return string generated MATCH expression.

buildAndMatch() public method

Connects two or more MATCH expressions with the AND or OR operator
public buildAndMatch ( string $operator, array $operands, array &$params ) : string
$operator string the operator which is used for connecting the given operands
$operands array the Match expressions to connect
$params array the expression parameters to be populated
return string the MATCH expression

buildHashMatch() public method

Creates a MATCH based on column-value pairs.
public buildHashMatch ( array $match, array &$params ) : string
$match array the match condition
$params array the expression parameters to be populated
return string the MATCH expression

buildIgnoreMatch() public method

Create ignored MATCH expressions
public buildIgnoreMatch ( string $operator, array $operands, &$params ) : string
$operator string the operator which is used for Create Match expressions
$operands array the Match expressions
return string the MATCH expression

buildMatch() public method

Create MATCH expression.
public buildMatch ( string | array $match, array &$params ) : string
$match string | array MATCH specification.
$params array the expression parameters to be populated
return string the MATCH expression

buildMatchColumn() protected method

Created column as string for expression of MATCH
protected buildMatchColumn ( string $column, boolean $ignored = false ) : string
$column string column specification.
$ignored boolean whether column should be specified as 'ignored'.
return string the column statement.

buildMatchValue() protected method

Create placeholder for expression of MATCH
protected buildMatchValue ( string | array | yii\db\Expression $value, array &$params ) : string
$value string | array | yii\db\Expression
$params array the expression parameters to be populated
return string the MATCH expression

buildMultipleMatch() public method

Create MAYBE, SENTENCE or PARAGRAPH expressions.
public buildMultipleMatch ( string $operator, array $operands, &$params ) : string
$operator string the operator which is used for Create Match expressions
$operands array the Match expressions
return string the MATCH expression

buildProximityMatch() public method

Create PROXIMITY expressions
public buildProximityMatch ( string $operator, array $operands, &$params ) : string
$operator string the operator which is used for Create Match expressions
$operands array the Match expressions
return string the MATCH expression

buildSimpleMatch() public method

Creates an Match expressions like "column" operator value.
public buildSimpleMatch ( string $operator, array $operands, array &$params ) : string
$operator string the operator to use. Anything could be used e.g. `>`, `<=`, etc.
$operands array contains two column names.
$params array the expression parameters to be populated
return string the MATCH expression

buildZoneMatch() public method

Create MATCH expressions for zones.
public buildZoneMatch ( string $operator, array $operands, &$params ) : string
$operator string the operator which is used for Create Match expressions
$operands array the Match expressions
return string the MATCH expression

parseParams() protected method

Returns the actual MATCH expression by inserting parameter values into the corresponding placeholders.
protected parseParams ( string $expression, array $params ) : string
$expression string the expression string which is needed to prepare.
$params array the binding parameters for inserting.
return string parsed expression.

Property Details

$db public_oe property

the Sphinx connection.
public $db

$matchBuilders protected_oe property

map of MATCH keywords to builder methods. These methods are used by [[buildMatch]] to build MATCH expression from array syntax.
protected $matchBuilders

$matchOperators protected_oe property

map of MATCH operators. These operators are used for replacement of verbose operators.
protected $matchOperators