Class yii\sphinx\MatchBuilder
Inheritance | yii\sphinx\MatchBuilder » yii\base\BaseObject |
---|---|
Implements | yii\base\Configurable |
Available since version | 2.0.6 |
Source Code | https://github.com/yiisoft/yii2-sphinx/blob/master/MatchBuilder.php |
MatchBuilder builds a MATCH SphinxQL expression based on the specification given as a yii\sphinx\MatchExpression object.
See also:
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$db | yii\sphinx\Connection | The Sphinx connection. | yii\sphinx\MatchBuilder |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$matchBuilders | array | Map of MATCH keywords to builder methods. | yii\sphinx\MatchBuilder |
$matchOperators | array | Map of MATCH operators. | yii\sphinx\MatchBuilder |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\BaseObject |
__construct() | Constructor. | yii\sphinx\MatchBuilder |
__get() | Returns the value of an object property. | yii\base\BaseObject |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\BaseObject |
__set() | Sets value of an object property. | yii\base\BaseObject |
__unset() | Sets an object property to null. | yii\base\BaseObject |
build() | Generates the MATCH expression from given yii\sphinx\MatchExpression object. | yii\sphinx\MatchBuilder |
buildAndMatch() | Connects two or more MATCH expressions with the AND or OR operator |
yii\sphinx\MatchBuilder |
buildHashMatch() | Creates a MATCH based on column-value pairs. | yii\sphinx\MatchBuilder |
buildIgnoreMatch() | Create ignored MATCH expressions | yii\sphinx\MatchBuilder |
buildMatch() | Create MATCH expression. | yii\sphinx\MatchBuilder |
buildMultipleMatch() | Create MAYBE, SENTENCE or PARAGRAPH expressions. | yii\sphinx\MatchBuilder |
buildProximityMatch() | Create PROXIMITY expressions | yii\sphinx\MatchBuilder |
buildSimpleMatch() | Creates an Match expressions like "column" operator value . |
yii\sphinx\MatchBuilder |
buildZoneMatch() | Create MATCH expressions for zones. | yii\sphinx\MatchBuilder |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\BaseObject |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\BaseObject |
className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\BaseObject |
hasProperty() | Returns a value indicating whether a property is defined. | yii\base\BaseObject |
init() | Initializes the object. | yii\base\BaseObject |
Protected Methods
Method | Description | Defined By |
---|---|---|
buildMatchColumn() | Created column as string for expression of MATCH | yii\sphinx\MatchBuilder |
buildMatchValue() | Create placeholder for expression of MATCH | yii\sphinx\MatchBuilder |
parseParams() | Returns the actual MATCH expression by inserting parameter values into the corresponding placeholders. | yii\sphinx\MatchBuilder |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
PARAM_PREFIX | ':mp' | The prefix for automatically generated query binding parameters. | yii\sphinx\MatchBuilder |
Property Details
The Sphinx connection.
Map of MATCH keywords to builder methods. These methods are used by buildMatch() to build MATCH expression from array syntax.
Map of MATCH operators. These operators are used for replacement of verbose operators.
Method Details
Constructor.
public void __construct ( $connection, $config = [] ) | ||
$connection | yii\sphinx\Connection | The Sphinx connection. |
$config | array | Name-value pairs that will be used to initialize the object properties |
Generates the MATCH expression from given yii\sphinx\MatchExpression object.
public string build ( $match ) | ||
$match | yii\sphinx\MatchExpression | The yii\sphinx\MatchExpression object from which the MATCH expression will be generated. |
return | string | Generated MATCH expression. |
---|
Connects two or more MATCH expressions with the AND
or OR
operator
public string buildAndMatch ( $operator, $operands, &$params ) | ||
$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 |
---|
Creates a MATCH based on column-value pairs.
public string buildHashMatch ( $match, &$params ) | ||
$match | array | The match condition |
$params | array | The expression parameters to be populated |
return | string | The MATCH expression |
---|
Create ignored MATCH expressions
public string buildIgnoreMatch ( $operator, $operands, &$params ) | ||
$operator | string | The operator which is used for Create Match expressions |
$operands | array | The Match expressions |
$params | ||
return | string | The MATCH expression |
---|
Create MATCH expression.
public string buildMatch ( $match, &$params ) | ||
$match | string|array | MATCH specification. |
$params | array | The expression parameters to be populated |
return | string | The MATCH expression |
---|
Created column as string for expression of MATCH
protected string buildMatchColumn ( $column, $ignored = false ) | ||
$column | string | Column specification. |
$ignored | boolean | Whether column should be specified as 'ignored'. |
return | string | The column statement. |
---|
Create placeholder for expression of MATCH
protected string buildMatchValue ( $value, &$params ) | ||
$value | string|array|yii\db\Expression | |
$params | array | The expression parameters to be populated |
return | string | The MATCH expression |
---|
Create MAYBE, SENTENCE or PARAGRAPH expressions.
public string buildMultipleMatch ( $operator, $operands, &$params ) | ||
$operator | string | The operator which is used for Create Match expressions |
$operands | array | The Match expressions |
$params | ||
return | string | The MATCH expression |
---|
Create PROXIMITY expressions
public string buildProximityMatch ( $operator, $operands, &$params ) | ||
$operator | string | The operator which is used for Create Match expressions |
$operands | array | The Match expressions |
$params | ||
return | string | The MATCH expression |
---|
Creates an Match expressions like "column" operator value
.
public string buildSimpleMatch ( $operator, $operands, &$params ) | ||
$operator | string | The operator to use. Anything could be used e.g. |
$operands | array | Contains two column names. |
$params | array | The expression parameters to be populated |
return | string | The MATCH expression |
---|---|---|
throws | yii\base\InvalidParamException | on invalid operands count. |
Create MATCH expressions for zones.
public string buildZoneMatch ( $operator, $operands, &$params ) | ||
$operator | string | The operator which is used for Create Match expressions |
$operands | array | The Match expressions |
$params | ||
return | string | The MATCH expression |
---|
Returns the actual MATCH expression by inserting parameter values into the corresponding placeholders.
protected string parseParams ( $expression, $params ) | ||
$expression | string | The expression string which is needed to prepare. |
$params | array | The binding parameters for inserting. |
return | string | Parsed expression. |
---|