diff --git a/Classes/Indexer/NodeIndexer.php b/Classes/Indexer/NodeIndexer.php index f1c56c3..dbbf782 100644 --- a/Classes/Indexer/NodeIndexer.php +++ b/Classes/Indexer/NodeIndexer.php @@ -50,12 +50,26 @@ class NodeIndexer extends ContentRepositoryAdaptor\Indexer\NodeIndexer */ public function indexNode(NodeInterface $node, $targetWorkspaceName = null) { + if( $node->isRemoved() ){ + $this->removeNode($node, $targetWorkspaceName); + return; + } if ($this->enableLiveAsyncIndexing !== true) { parent::indexNode($node, $targetWorkspaceName); return; } + if ($this->settings['indexAllWorkspaces'] === false) { + if ($targetWorkspaceName !== null && $targetWorkspaceName !== 'live') { + return; + } + + if ($targetWorkspaceName === null && $node->getContext()->getWorkspaceName() !== 'live') { + return; + } + } + $indexingJob = new IndexingJob($this->indexNamePostfix, $targetWorkspaceName, $this->nodeAsArray($node)); $this->jobManager->queue(NodeIndexQueueCommandController::LIVE_QUEUE_NAME, $indexingJob); } @@ -72,6 +86,16 @@ public function removeNode(NodeInterface $node, $targetWorkspaceName = null) return; } + if ($this->settings['indexAllWorkspaces'] === false) { + if ($targetWorkspaceName !== null && $targetWorkspaceName !== 'live') { + return; + } + + if ($targetWorkspaceName === null && $node->getContext()->getWorkspaceName() !== 'live') { + return; + } + } + $removalJob = new RemovalJob($this->indexNamePostfix, $targetWorkspaceName, $this->nodeAsArray($node)); $this->jobManager->queue(NodeIndexQueueCommandController::LIVE_QUEUE_NAME, $removalJob); } @@ -88,7 +112,7 @@ protected function nodeAsArray(NodeInterface $node) [ 'persistenceObjectIdentifier' => $this->persistenceManager->getIdentifierByObject($node->getNodeData()), 'identifier' => $node->getIdentifier(), - 'dimensions' => $node->getDimensions(), + 'dimensions' => $node->getContext()->getDimensions(), 'workspace' => $node->getWorkspace()->getName(), 'nodeType' => $node->getNodeType()->getName(), 'path' => $node->getPath() diff --git a/composer.json b/composer.json index 6e81c91..92e097a 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "flowpack/jobqueue-common": "^3.0 || dev-master", - "flowpack/elasticsearch-contentrepositoryadaptor": "^4.0" + "flowpack/elasticsearch-contentrepositoryadaptor": "^4.0 || ^5.0" }, "autoload": { "psr-4": {