eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway\DoctrineDatabase::remove PHP Method

remove() public method

Ported from the legacy code
See also: https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/search/plugins/ezsearchengine/ezsearchengine.php#L386
public remove ( mixed $contentId, mixed | null $versionId = null ) : boolean
$contentId mixed
$versionId mixed | null
return boolean
    public function remove($contentId, $versionId = null)
    {
        $doDelete = false;
        $this->dbHandler->beginTransaction();
        // fetch all the words and decrease the object count on all the words
        $wordIDList = $this->searchIndex->getContentObjectWords($contentId);
        if (count($wordIDList) > 0) {
            $this->searchIndex->decrementWordObjectCount($wordIDList);
            $doDelete = true;
        }
        if ($doDelete) {
            $this->searchIndex->deleteWordsWithoutObjects();
            $this->searchIndex->deleteObjectWordsLink($contentId);
        }
        $this->dbHandler->commit();
        return true;
    }