public static function instance($node = 'search') { $conf = C('search.' . $node); if (empty($conf)) { logFatal(__CLASS__ . '/' . __FUNCTION__ . ":config error,please check"); } $cl = new self(); $cl->SetServer($conf['host'], $conf['port']); $cl->SetConnectTimeout($conf['timeout']); $cl->SetArrayResult(true); $cl->SetMatchMode(SPH_MATCH_ANY); return $cl; }
public static function initServer($config) { $class = new self(); $class->SetServer($config['host'], (int) $config['port']); $class->SetArrayResult(true); $class->SetConnectTimeout(1); $class->SetMatchMode(SPH_MATCH_ALL); return $class; }