Sphinx\SphinxClient::setMatchMode PHP Method

setMatchMode() public method

Set matching mode
public setMatchMode ( integer $mode ) : SphinxClient
$mode integer
return SphinxClient
    public function setMatchMode($mode)
    {
        if (!in_array($mode, array(self::SPH_MATCH_ALL, self::SPH_MATCH_ANY, self::SPH_MATCH_PHRASE, self::SPH_MATCH_BOOLEAN, self::SPH_MATCH_EXTENDED, self::SPH_MATCH_FULLSCAN, self::SPH_MATCH_EXTENDED2))) {
            throw new \InvalidArgumentException('Matching mode is invalid.');
        }
        $this->mode = $mode;
        return $this;
    }

Usage Example

Example #1
0
 public function testAddQueryWithError()
 {
     $sphinx = new SphinxClient();
     $sphinx->setMatchMode(SphinxClient::SPH_MATCH_EXTENDED);
     $sphinx->addQuery('@ccc');
     $sphinx->addQuery('dddd');
     $results = $sphinx->runQueries();
     $this->assertEquals(count($results), 2);
     $this->assertGreaterThan(0, strlen($results[0]['error']));
 }
All Usage Examples Of Sphinx\SphinxClient::setMatchMode