public function buildIndex(Index $index)
 {
     $output = 'index ' . $index->getId() . "\r\n{\r\n";
     foreach ($index->getFields() as $field) {
         $output .= "\trt_field = {$field}\r\n";
     }
     foreach ($index->getAttributes() as $name => $type) {
         switch ($type) {
             case 'float':
                 $sphinx_type = 'float';
                 break;
             case 'int':
                 $sphinx_type = 'uint';
                 break;
             case 'datetime':
                 $sphinx_type = 'timestamp';
                 break;
             default:
                 $sphinx_type = 'string';
                 break;
         }
         $output .= "\trt_attr_{$sphinx_type} = {$name}\r\n";
     }
     foreach ($index->getConfig() as $key => $val) {
         if (is_array($val)) {
             $val = implode(',', $val);
         }
         if ($val) {
             $output .= "\t{$key} = {$val}\r\n";
         }
     }
     $output .= "}\r\n";
     return $output;
 }
 /**
  * Inserts an array of objects in the type
  *
  * @param array of domain model objects
  **/
 public function insertMany(array $objects)
 {
     $documents = array();
     foreach ($objects as $object) {
         $documents[] = $this->transformToSphinxDocument($object);
     }
     $this->index->insertMany($documents);
 }