/** * Reset settings sphinx */ public function resetClient() { $this->_client->resetFilters(); $this->_client->resetGroupBy(); $this->_client->setArrayResult(false); //DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API //$this->_client->setMatchMode(SPH_MATCH_EXTENDED2); $this->_client->setLimits(0, 20, 1000, 0); $this->_client->setFieldWeights(array()); $this->_client->setSortMode(SPH_SORT_RELEVANCE, ''); $this->_client->_error = ''; $this->_client->_warning = ''; }
/** * Reset all previously set filters. */ public function resetFilters() { $this->sphinx->resetFilters(); }
/** * Adds this query to the SphinxClient $sphinx * * Adding the query resets the passed SphinxClient so that no existing * filters or group bys or sort order etc are inherited by this query. * The query details are then injected into Sphinx, and the resulting * id passed back to this query allowing the results to be mapped to * the query. * * @param \SphinxClient $sphinx * * @return $this */ public function bindToSphinx(\SphinxClient $sphinx) { $sphinx->resetFilters(); $sphinx->resetGroupBy(); $sphinx->setRankingMode($this->rankingMode); if ($this->groupBy instanceof GroupBy) { $this->groupBy->bindToSphinx($sphinx); } $this->sortBy->bindToSphinx($sphinx); $this->limits->bindToSphinx($sphinx); /* @var FilterInterface $filter */ foreach ($this->filters as $filter) { $filter->bindToSphinx($sphinx); } if ($this->builder instanceof Builder && !$this->query) { $this->query = $this->builder->getQuery(); } $this->id = $sphinx->addQuery($this->query, $this->index->getIndexName()); return $this; }
/** * @brief reset search criteria to default * @details reset conditions and set default search options */ public function resetCriteria() { if (is_object($this->criteria)) { $this->lastCriteria = clone $this->criteria; } else { $this->lastCriteria = new stdClass(); } $this->criteria = new stdClass(); $this->criteria->query = ''; $this->client->resetFilters(); $this->client->resetGroupBy(); $this->client->setArrayResult(false); $this->client->setMatchMode($this->matchMode); // $this->client->setRankingMode($this->rankMode); $this->client->setSortMode(SPH_SORT_RELEVANCE, '@relevance DESC'); $this->client->setLimits(0, 1000000, 10000); if (!empty($this->fieldWeights)) { $this->client->setFieldWeights($this->fieldWeights); } }