Sphinx\SphinxClient::__construct PHP Method

__construct() public method

Create a new client object and fill defaults
public __construct ( )
    public function __construct()
    {
        // per-client-object settings
        $this->host = 'localhost';
        $this->port = 9312;
        $this->path = false;
        $this->socket = false;
        // per-query settings
        $this->offset = 0;
        $this->limit = 20;
        $this->mode = self::SPH_MATCH_ALL;
        $this->weights = array();
        $this->sort = self::SPH_SORT_RELEVANCE;
        $this->sortby = '';
        $this->minid = 0;
        $this->maxid = 0;
        $this->filters = array();
        $this->groupby = '';
        $this->groupfunc = self::SPH_GROUPBY_DAY;
        $this->groupsort = '@group desc';
        $this->groupdistinct = '';
        $this->maxmatches = 1000;
        $this->cutoff = 0;
        $this->retrycount = 0;
        $this->retrydelay = 0;
        $this->anchor = array();
        $this->indexweights = array();
        $this->ranker = self::SPH_RANK_PROXIMITY_BM25;
        $this->rankexpr = '';
        $this->maxquerytime = 0;
        $this->fieldweights = array();
        $this->overrides = array();
        $this->select = '*';
        // per-reply fields (for single-query case)
        $this->error = '';
        $this->warning = '';
        $this->connerror = false;
        // requests storage (for multi-query case)
        $this->reqs = array();
        $this->mbenc = '';
        $this->arrayresult = false;
        $this->timeout = 0;
    }

Usage Example

 /**
  * Create a Sphinx client with the additional functionalities of FSphinx.
  * If no default index is defined, queries all indexes by default.
  *
  * @param string $default_index Limit Sphinx search to this index.
  */
 public function __construct($default_index = null)
 {
     $this->facets = null;
     $this->_query_parser = null;
     $this->_query = null;
     $this->_default_index = $default_index ?: '*';
     $this->_filtering = false;
     $this->_options = array();
     parent::__construct();
 }