/**
  * 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;
 }
Пример #2
0
 public function testBindToSphinx()
 {
     $this->object->bindToSphinx($this->I->getSphinxClientMock());
 }