public function testBindToSphinxWillIgnoreQueryBuilderIfQuerySet()
 {
     $builder = $this->object->createQueryBuilder();
     $builder->in()->whereField()->contains('bob alan derek');
     $this->object->setQuery('sue alice colby');
     $this->object->bindToSphinx($this->I->getSphinxClientMock());
     $this->assertNotEquals('(bob alan derek)', $this->object->getQuery());
 }
Exemplo n.º 2
0
 /**
  * Wraps the result in an object
  *
  * @param integer $key
  * @param array   $result
  *
  * @return ResultRecord
  */
 protected function getResult($key, $result)
 {
     $class = ResultRecord::class;
     if ($this->query->getIndex()) {
         $class = $this->query->getIndex()->getResultClass();
     }
     if ($class !== ResultRecord::class && !is_subclass_of($class, ResultRecord::class)) {
         throw new \RuntimeException(sprintf('ResultClass specified in SearchIndex must extend ResultsRecord, "%s" is not valid', $class));
     }
     return new $class($key, $result);
 }
 /**
  * Adds a search query, note: queries cannot be removed once added
  *
  * @param SearchQuery $query
  *
  * @return $this
  */
 public function addQuery(SearchQuery $query)
 {
     $query->bindToSphinx($this->getCurrentConnection());
     $this->queries[$query->getId()] = $query;
     return $this;
 }
 /**
  * @param SearchQuery $query
  *
  * @return $this
  */
 public function addQuery(SearchQuery $query)
 {
     $this->queries[$query->getIndex()->getIndexName()] = $query;
     return $this;
 }