@@ -50,12 +50,26 @@ class NodeIndexer extends ContentRepositoryAdaptor\Indexer\NodeIndexer
5050 */
5151 public function indexNode (NodeInterface $ node , $ targetWorkspaceName = null )
5252 {
53+ if ( $ node ->isRemoved () ){
54+ $ this ->removeNode ($ node , $ targetWorkspaceName );
55+ return ;
56+ }
5357 if ($ this ->enableLiveAsyncIndexing !== true ) {
5458 parent ::indexNode ($ node , $ targetWorkspaceName );
5559
5660 return ;
5761 }
5862
63+ if ($ this ->settings ['indexAllWorkspaces ' ] === false ) {
64+ if ($ targetWorkspaceName !== null && $ targetWorkspaceName !== 'live ' ) {
65+ return ;
66+ }
67+
68+ if ($ targetWorkspaceName === null && $ node ->getContext ()->getWorkspaceName () !== 'live ' ) {
69+ return ;
70+ }
71+ }
72+
5973 $ indexingJob = new IndexingJob ($ this ->indexNamePostfix , $ targetWorkspaceName , $ this ->nodeAsArray ($ node ));
6074 $ this ->jobManager ->queue (NodeIndexQueueCommandController::LIVE_QUEUE_NAME , $ indexingJob );
6175 }
@@ -72,6 +86,16 @@ public function removeNode(NodeInterface $node, $targetWorkspaceName = null)
7286 return ;
7387 }
7488
89+ if ($ this ->settings ['indexAllWorkspaces ' ] === false ) {
90+ if ($ targetWorkspaceName !== null && $ targetWorkspaceName !== 'live ' ) {
91+ return ;
92+ }
93+
94+ if ($ targetWorkspaceName === null && $ node ->getContext ()->getWorkspaceName () !== 'live ' ) {
95+ return ;
96+ }
97+ }
98+
7599 $ removalJob = new RemovalJob ($ this ->indexNamePostfix , $ targetWorkspaceName , $ this ->nodeAsArray ($ node ));
76100 $ this ->jobManager ->queue (NodeIndexQueueCommandController::LIVE_QUEUE_NAME , $ removalJob );
77101 }
@@ -88,7 +112,7 @@ protected function nodeAsArray(NodeInterface $node)
88112 [
89113 'persistenceObjectIdentifier ' => $ this ->persistenceManager ->getIdentifierByObject ($ node ->getNodeData ()),
90114 'identifier ' => $ node ->getIdentifier (),
91- 'dimensions ' => $ node ->getDimensions (),
115+ 'dimensions ' => $ node ->getContext ()-> getDimensions (),
92116 'workspace ' => $ node ->getWorkspace ()->getName (),
93117 'nodeType ' => $ node ->getNodeType ()->getName (),
94118 'path ' => $ node ->getPath ()
0 commit comments