public function testCanCastToString()
 {
     $builder = Builder::find(new SearchIndex('bob', ['name', 'address']))->in('name,address')->whereField()->containsOneOf('jim alex', 'bob')->containsStrictOrderOf('bob', 'alex smith')->end()->end()->notIn('address', 30)->whereField()->contains('plymouth')->end()->end();
     $query = $builder->getQuery();
     $this->assertEquals('(@(name,address) ("jim alex"|bob) bob << "alex smith") (@!address[30] plymouth)', (string) $builder);
     $this->assertEquals('(@(name,address) ("jim alex"|bob) bob << "alex smith") (@!address[30] plymouth)', $query);
 }
 /**
  * Set a pre-built Builder instance
  *
  * Raises exception if the Builder index is not the same as the query index.
  *
  * @param Builder $builder
  *
  * @return $this
  */
 public function setQueryBuilder(Builder $builder)
 {
     if ($this->index !== $builder->getIndex()) {
         throw new \InvalidArgumentException(sprintf('Index mismatch in builder "%s" vs query "%s"', $builder->getIndex()->getIndexName(), $this->index->getIndexName()));
     }
     $this->builder = $builder;
     return $this;
 }