/**
  * Removes a content object by ID from the search database.
  *
  * @since 5.0
  *
  * @param int $contentObjectId The content object to remove by ID
  * @param bool $commit Whether to commit after removing the object
  *
  * @return bool True if the operation succeeded
  */
 public function removeObjectById($contentObjectId, $commit = null)
 {
     // Indexing is not implemented in eZ Publish 5 legacy search engine
     if ($this->searchEngine == 'legacy') {
         $searchEngine = new eZSearchEngine();
         $searchEngine->removeObjectById($contentObjectId, $commit);
     } else {
         $this->searchHandler->deleteContent((int) $contentObjectId);
     }
     if ($commit) {
         $this->commit();
     }
     return true;
 }
예제 #2
0
 /**
  * Removes a content object by ID from the search database.
  *
  * @since 5.0
  *
  * @param int $contentObjectId The content object to remove by ID
  * @param bool $commit Whether to commit after removing the object
  *
  * @return bool True if the operation succeeded
  */
 public function removeObjectById($contentObjectId, $commit = null)
 {
     if (!isset($commit) && $this->iniConfig->variable('IndexOptions', 'DisableDeleteCommits') === 'true') {
         $commit = false;
     } elseif (!isset($commit)) {
         $commit = true;
     }
     // Indexing is not implemented in eZ Publish 5 legacy search engine
     if ($this->searchHandler instanceof LegacyHandler) {
         $searchEngine = new eZSearchEngine();
         $searchEngine->removeObjectById($contentObjectId, $commit);
         return true;
     }
     $this->searchHandler->deleteContent((int) $contentObjectId);
     if ($commit) {
         $this->commit();
     }
     return true;
 }