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) {