Skip to content

Commit

Permalink
Index - Undo versioned check to combine with __unserialise fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Hermo committed Apr 12, 2024
1 parent a73313a commit ddf1115
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/Service/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
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;
use SilverStripe\SearchService\Interfaces\DocumentRemoveHandler;
use SilverStripe\SearchService\Interfaces\IndexingInterface;
use SilverStripe\SearchService\Service\Traits\ConfigurationAware;
use SilverStripe\SearchService\Service\Traits\ServiceAware;
use SilverStripe\Versioned\Versioned;

class Indexer
{
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ddf1115

Please sign in to comment.