delete() abstract public method

Deletes a single document of the given $type by given document $id.
abstract public delete ( integer | string $id, string $type )
$id integer | string
$type string
コード例 #1
0
ファイル: Handler.php プロジェクト: nlescure/ezpublish-kernel
 /**
  * Deletes a content object from the index
  *
  * @param int $contentId
  * @param int|null $versionId
  *
  * @return void
  */
 public function deleteContent($contentId, $versionId = null)
 {
     if ($versionId === null) {
         $ast = array("query" => array("filtered" => array("filter" => array("and" => array(array("ids" => array("type" => $this->documentTypeName, "values" => array($contentId))))))));
         $this->gateway->deleteByQuery(json_encode($ast), "content");
     } else {
         $this->gateway->delete($contentId, "content");
     }
 }
コード例 #2
0
ファイル: Handler.php プロジェクト: Heyfara/ezpublish-kernel
 /**
  * Deletes a content object from the index.
  *
  * @param int $contentId
  * @param int|null $versionId
  */
 public function deleteContent($contentId, $versionId = null)
 {
     if ($versionId === null) {
         $ast = array('query' => array('filtered' => array('filter' => array('and' => array(array('ids' => array('type' => $this->documentTypeName, 'values' => array($contentId))))))));
         $this->gateway->deleteByQuery(json_encode($ast), 'content');
     } else {
         $this->gateway->delete($contentId, 'content');
     }
 }
コード例 #3
0
ファイル: Handler.php プロジェクト: emodric/ezpublish-kernel
 /**
  * Deletes a content object from the index.
  *
  * @param int $contentId
  * @param int|null $versionId
  */
 public function deleteContent($contentId, $versionId = null)
 {
     // 1. Delete the Content
     if ($versionId === null) {
         $this->gateway->deleteByQuery(json_encode(['query' => ['match' => ['_id' => $contentId]]]), $this->contentDocumentTypeIdentifier);
     } else {
         $this->gateway->delete($contentId, $this->contentDocumentTypeIdentifier);
     }
     // 2. Delete all Content's Locations
     $this->gateway->deleteByQuery(json_encode(['query' => ['match' => ['content_id_id' => $contentId]]]), $this->locationDocumentTypeIdentifier);
 }
コード例 #4
0
ファイル: Handler.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * Deletes a location from the index.
  *
  * @todo When we support Location-less Content, we will have to reindex instead of removing
  * @todo Should we not already support the above?
  * @todo The subtree could potentially be huge, so this implementation should scroll reindex
  *
  * @param mixed $locationId
  * @param mixed $contentId @todo Make use of this, or remove if not needed.
  */
 public function deleteLocation($locationId, $contentId)
 {
     // 1. Delete the Location
     $this->gateway->delete($locationId, $this->locationDocumentTypeIdentifier);
     // 2. Update (reindex) all Content in the subtree with additional Location(s) outside of it
     $ast = array('filter' => array('nested' => array('path' => 'locations_doc', 'filter' => array('and' => array(0 => array('regexp' => array('locations_doc.path_string_id' => ".*/{$locationId}/.*")), 1 => array('regexp' => array('locations_doc.path_string_id' => array('value' => "@&~(.*/{$locationId}/.*)", 'flags' => 'INTERSECTION|COMPLEMENT|ANYSTRING'))))))));
     $response = $this->gateway->findRaw(json_encode($ast), $this->contentDocumentTypeIdentifier);
     $result = json_decode($response->body);
     $documents = array();
     foreach ($result->hits->hits as $hit) {
         $documents[] = $this->mapper->mapContentById($hit->_id);
     }
     $this->gateway->bulkIndex($documents);
     // 3. Delete all Content in the subtree with no other Location(s) outside of it
     $ast['filter']['nested']['filter']['and'][1] = array('not' => $ast['filter']['nested']['filter']['and'][1]);
     $ast = array('query' => array('filtered' => $ast));
     $this->gateway->deleteByQuery(json_encode($ast), $this->contentDocumentTypeIdentifier);
 }
コード例 #5
0
 /**
  * Deletes a Location from the index storage
  *
  * @param int|string $locationId
  */
 public function deleteLocation($locationId)
 {
     $this->gateway->delete($locationId, "location");
 }
コード例 #6
0
ファイル: Handler.php プロジェクト: nlescure/ezpublish-kernel
 /**
  * Deletes a Location from the index storage
  *
  * @param int|string $locationId
  */
 public function deleteLocation($locationId)
 {
     $this->gateway->delete($locationId, $this->documentTypeName);
 }