From ddf1115c58ff40e19f8c471f1f2795c95c53a8d4 Mon Sep 17 00:00:00 2001 From: Marco Hermo Date: Fri, 12 Apr 2024 12:19:59 +1200 Subject: [PATCH] Index - Undo versioned check to combine with __unserialise fix --- src/Service/Indexer.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/Service/Indexer.php b/src/Service/Indexer.php index 8cd10d2..9ea719e 100644 --- a/src/Service/Indexer.php +++ b/src/Service/Indexer.php @@ -5,8 +5,6 @@ use InvalidArgumentException; use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\ORM\DataObject; -use SilverStripe\SearchService\Interfaces\DataObjectDocumentInterface; use SilverStripe\SearchService\Interfaces\DependencyTracker; use SilverStripe\SearchService\Interfaces\DocumentAddHandler; use SilverStripe\SearchService\Interfaces\DocumentInterface; @@ -14,7 +12,6 @@ use SilverStripe\SearchService\Interfaces\IndexingInterface; use SilverStripe\SearchService\Service\Traits\ConfigurationAware; use SilverStripe\SearchService\Service\Traits\ServiceAware; -use SilverStripe\Versioned\Versioned; class Indexer { @@ -80,16 +77,6 @@ public function processNode(): void $document->onAddToSearchIndexes(DocumentAddHandler::BEFORE_ADD); } - if ($document instanceof DataObjectDocumentInterface) { - // Making sure we get the Live version of the DataObject before indexing the document - Versioned::withVersionedMode(static function () use ($document): void { - Versioned::set_stage(Versioned::LIVE); - $dataObject = $document->getDataObject(); - $liveDataObject = DataObject::get($dataObject->ClassName)->byID($dataObject->ID); - $document->setDataObject($liveDataObject); - }); - } - $toUpdate[] = $document; } else { if ($document instanceof DocumentRemoveHandler) {