Esempio n. 1
0
 /**
  * {@inheritDoc}
  */
 public function removeDocuments(ClassMetadata $class, array $documents)
 {
     $idsByIndex = array();
     foreach ($documents as $document) {
         if (!isset($document['id'])) {
             throw new \RuntimeException(__METHOD__ . ": Unable to remove document with no id");
         }
         $idsByIndex[$class->getIndexForWrite($document)][] = $document['id'];
     }
     foreach ($idsByIndex as $index => $ids) {
         $type = $this->getIndex($index)->getType($class->type);
         $type->deleteByQuery(new Query\Terms('id', $ids));
     }
 }