yii\sphinx\Query::match PHP Method

match() public method

Note: this value will be processed by [[Connection::escapeMatchValue()]], if you need to compose complex match condition use [[Expression]]: php $query = new Query(); $query->from('my_index') ->match(new Expression(':match', ['match' => '@(content) ' . Yii::$app->sphinx->escapeMatchValue($matchValue)])) ->all();
public match ( string | yii\db\Expression | MatchExpression $query )
$query string | yii\db\Expression | MatchExpression fulltext query text.
    public function match($query)
    {
        $this->match = $query;
        return $this;
    }

Usage Example

Beispiel #1
0
 public function testMatch()
 {
     $query = new Query();
     $match = 'test match';
     $query->match($match);
     $this->assertEquals($match, $query->match);
     $command = $query->createCommand($this->getConnection(false));
     $this->assertContains('MATCH(', $command->getSql(), 'No MATCH operator present!');
     $this->assertContains($match, $command->params, 'No match query among params!');
 }