|
16 | 16 | use Flowpack\ElasticSearch\Domain\Model\Client; |
17 | 17 | use Flowpack\ElasticSearch\Domain\Model\Document as ElasticSearchDocument; |
18 | 18 | use Flowpack\ElasticSearch\Domain\Model\Index; |
19 | | -use TYPO3\Eel\FlowQuery\FlowQuery; |
20 | 19 | use TYPO3\Flow\Annotations as Flow; |
21 | 20 | use TYPO3\TYPO3CR\Domain\Model\NodeInterface; |
22 | 21 | use TYPO3\TYPO3CR\Domain\Service\ContentDimensionCombinator; |
@@ -259,22 +258,25 @@ public function indexNode(NodeInterface $node, $targetWorkspaceName = null) |
259 | 258 | $this->logger->log(sprintf('NodeIndexer: Added / updated node %s. ID: %s Context: %s', $contextPath, $contextPathHash, json_encode($node->getContext()->getProperties())), LOG_DEBUG, null, 'ElasticSearch (CR)'); |
260 | 259 | }; |
261 | 260 |
|
262 | | - $combinations = $this->contentDimensionCombinator->getAllAllowedCombinations(); |
263 | | - $contextProperties = $node->getContext()->getProperties(); |
264 | | - foreach ($combinations as $combination) { |
265 | | - $dimensions = array_merge($contextProperties['dimensions'], $combination); |
266 | | - $targetDimensions = array_merge($contextProperties['targetDimensions'], [ 'language' => $combination['language'][0] ]); |
267 | | - $query = new FlowQuery([$node]); |
268 | | - $query->pushOperation('context', [[ |
269 | | - 'dimensions' => $dimensions, |
270 | | - 'targetDimensions' => $targetDimensions |
271 | | - ]]); |
272 | | - /** @var NodeInterface $indexableNode */ |
273 | | - $indexableNode = $query->get(0); |
274 | | - if ($indexableNode instanceof NodeInterface) { |
275 | | - $indexer($indexableNode, $targetWorkspaceName); |
| 261 | + $dimensionCombinations = $this->contentDimensionCombinator->getAllAllowedCombinations(); |
| 262 | + $workspaceName = $targetWorkspaceName ?: 'live'; |
| 263 | + $nodeIdentifier = $node->getIdentifier(); |
| 264 | + if ($dimensionCombinations !== []) { |
| 265 | + foreach ($dimensionCombinations as $combination) { |
| 266 | + $context = $this->contextFactory->create(array('workspaceName' => $workspaceName, 'dimensions' => $combination)); |
| 267 | + $node = $context->getNodeByIdentifier($nodeIdentifier); |
| 268 | + if ($node !== null) { |
| 269 | + $indexer($node, $targetWorkspaceName); |
| 270 | + } |
| 271 | + } |
| 272 | + } else { |
| 273 | + $context = $this->contextFactory->create(array('workspaceName' => $workspaceName)); |
| 274 | + $node = $context->getNodeByIdentifier($nodeIdentifier); |
| 275 | + if ($node !== NULL) { |
| 276 | + $indexer($node, $targetWorkspaceName); |
276 | 277 | } |
277 | 278 | } |
| 279 | + |
278 | 280 | } |
279 | 281 |
|
280 | 282 | /** |
|
0 commit comments