11<?php
22namespace Flowpack \ElasticSearch \ContentRepositoryQueueIndexer ;
33
4- use Flowpack \ElasticSearch \ContentRepositoryAdaptor \Indexer \NodeIndexer ;
5- use Flowpack \ElasticSearch \ContentRepositoryQueueIndexer \Domain \Repository \NodeDataRepository ;
6- use Flowpack \JobQueue \Common \Job \JobInterface ;
4+ use Flowpack \ElasticSearch \ContentRepositoryAdaptor \Exception ;
75use Flowpack \JobQueue \Common \Queue \Message ;
86use Flowpack \JobQueue \Common \Queue \QueueInterface ;
97use Neos \ContentRepository \Domain \Model \NodeData ;
108use Neos \Flow \Annotations as Flow ;
11- use Neos \Flow \Utility \Algorithms ;
12- use Neos \ContentRepository \Domain \Factory \NodeFactory ;
139use Neos \ContentRepository \Domain \Model \NodeInterface ;
14- use Neos \ContentRepository \Domain \Service \ContextFactoryInterface ;
1510
1611/**
1712 * Elasticsearch Node Indexing Job
1813 */
19- class IndexingJob implements JobInterface
14+ class IndexingJob extends AbstractIndexingJob
2015{
21- use LoggerTrait;
22-
23- /**
24- * @var NodeIndexer
25- * @Flow\Inject
26- */
27- protected $ nodeIndexer ;
28-
29- /**
30- * @var NodeDataRepository
31- * @Flow\Inject
32- */
33- protected $ nodeDataRepository ;
34-
35- /**
36- * @var NodeFactory
37- * @Flow\Inject
38- */
39- protected $ nodeFactory ;
40-
41- /**
42- * @var ContextFactoryInterface
43- * @Flow\Inject
44- */
45- protected $ contextFactory ;
46-
47- /**
48- * @var string
49- */
50- protected $ identifier ;
51-
52- /**
53- * @var string
54- */
55- protected $ targetWorkspaceName ;
56-
57- /**
58- * @var string
59- */
60- protected $ indexPostfix ;
61-
62- /**
63- * @var array
64- */
65- protected $ nodes = [];
66-
67- /**
68- * @param string $indexPostfix
69- * @param string $targetWorkspaceName In case indexing is triggered during publishing, a target workspace name will be passed in
70- * @param array $nodes
71- */
72- public function __construct ($ indexPostfix , $ targetWorkspaceName , array $ nodes )
73- {
74- $ this ->identifier = Algorithms::generateRandomString (24 );
75- $ this ->targetWorkspaceName = $ targetWorkspaceName ;
76- $ this ->indexPostfix = $ indexPostfix ;
77- $ this ->nodes = $ nodes ;
78- }
79-
8016 /**
8117 * Execute the indexing of nodes
8218 *
@@ -95,7 +31,7 @@ public function execute(QueueInterface $queue, Message $message)
9531
9632 // Skip this iteration if the nodedata can not be fetched (deleted node)
9733 if (!$ nodeData instanceof NodeData) {
98- $ this ->log (sprintf ('action=indexing step=failed node=%s message="Node data could not be loaded" ' , $ node ['nodeIdentifier ' ]));
34+ $ this ->log (sprintf ('action=indexing step=failed node=%s message="Node data could not be loaded" ' , $ node ['nodeIdentifier ' ]), \ LOG_ERR );
9935 continue ;
10036 }
10137
@@ -128,16 +64,6 @@ public function execute(QueueInterface $queue, Message $message)
12864 return true ;
12965 }
13066
131- /**
132- * Get an optional identifier for the job
133- *
134- * @return string A job identifier
135- */
136- public function getIdentifier ()
137- {
138- return $ this ->identifier ;
139- }
140-
14167 /**
14268 * Get a readable label for the job
14369 *
0 commit comments