@@ -287,12 +287,13 @@ public function indexNode(NodeInterface $node, $targetWorkspaceName = null): voi
287287
288288 $ workspaceName = $ targetWorkspaceName ?: $ node ->getContext ()->getWorkspaceName ();
289289 $ dimensionCombinations = $ this ->contentDimensionCombinator ->getAllAllowedCombinations ();
290- if ($ dimensionCombinations !== []) {
290+
291+ if (array_filter ($ dimensionCombinations ) === []) {
292+ $ handleNode ($ node , $ this ->createContentContext ($ workspaceName ));
293+ } else {
291294 foreach ($ dimensionCombinations as $ combination ) {
292295 $ handleNode ($ node , $ this ->createContentContext ($ workspaceName , $ combination ));
293296 }
294- } else {
295- $ handleNode ($ node , $ this ->createContentContext ($ workspaceName ));
296297 }
297298 }
298299
@@ -307,9 +308,11 @@ protected function createContentContext(string $workspaceName, array $dimensions
307308 'workspaceName ' => $ workspaceName ,
308309 'invisibleContentShown ' => true
309310 ];
311+
310312 if ($ dimensions !== []) {
311313 $ configuration ['dimensions ' ] = $ dimensions ;
312314 }
315+
313316 return $ this ->contextFactory ->create ($ configuration );
314317 }
315318
@@ -390,7 +393,7 @@ public function removeNode(NodeInterface $node, string $targetWorkspaceName = nu
390393 */
391394 protected function flushIfNeeded (): void
392395 {
393- if ($ this ->bulkRequestLenght () >= $ this ->batchSize ['elements ' ] || $ this ->bulkRequestSize () >= $ this ->batchSize ['octets ' ]) {
396+ if ($ this ->bulkRequestLength () >= $ this ->batchSize ['elements ' ] || $ this ->bulkRequestSize () >= $ this ->batchSize ['octets ' ]) {
394397 $ this ->flush ();
395398 }
396399 }
@@ -402,7 +405,10 @@ protected function bulkRequestSize(): int
402405 }, 0 );
403406 }
404407
405- protected function bulkRequestLenght (): int
408+ /**
409+ * @return int
410+ */
411+ protected function bulkRequestLength (): int
406412 {
407413 return count ($ this ->currentBulkRequest );
408414 }
@@ -418,7 +424,7 @@ protected function bulkRequestLenght(): int
418424 public function flush (): void
419425 {
420426 $ bulkRequest = $ this ->currentBulkRequest ;
421- $ bulkRequestSize = $ this ->bulkRequestLenght ();
427+ $ bulkRequestSize = $ this ->bulkRequestLength ();
422428 if ($ bulkRequestSize === 0 ) {
423429 return ;
424430 }
@@ -442,9 +448,7 @@ public function flush(): void
442448
443449 foreach ($ bulkRequestPart ->getRequest () as $ bulkRequestItem ) {
444450 if ($ bulkRequestItem === null ) {
445- $ this ->errorHandlingService ->log (
446- new MalformedBulkRequestError ('Indexing Error: Bulk request item could not be encoded as JSON - ' . json_last_error_msg (), $ bulkRequestItem )
447- );
451+ $ this ->errorHandlingService ->log (new MalformedBulkRequestError ('Indexing Error: Bulk request item could not be encoded as JSON - ' . json_last_error_msg (), $ bulkRequestItem ));
448452 continue 2 ;
449453 }
450454 $ payload [$ hash ][] = $ bulkRequestItem ;
@@ -462,10 +466,8 @@ public function flush(): void
462466 }
463467
464468 $ this ->searchClient ->setDimensions ($ dimensions );
465-
466469 $ response = $ this ->requestDriver ->bulk ($ this ->getIndex (), implode (chr (10 ), $ payload [$ hash ]));
467470
468-
469471 foreach ($ response as $ responseLine ) {
470472 if (isset ($ response ['errors ' ]) && $ response ['errors ' ] !== false ) {
471473 $ this ->errorHandlingService ->log (new BulkIndexingError ($ this ->currentBulkRequest , $ responseLine ));
@@ -476,7 +478,7 @@ public function flush(): void
476478 $ this ->reset ();
477479 }
478480
479- protected function reset ()
481+ protected function reset (): void
480482 {
481483 $ this ->dimensionService ->reset ();
482484 $ this ->currentBulkRequest = [];
0 commit comments