1111 * source code.
1212 */
1313
14+ use Flowpack \ElasticSearch \ContentRepositoryAdaptor \LoggerInterface ;
1415use Flowpack \ElasticSearch \ContentRepositoryAdaptor \Mapping \NodeTypeMappingBuilder ;
1516use Flowpack \ElasticSearch \ContentRepositoryAdaptor \Service \IndexWorkspaceTrait ;
17+ use Flowpack \ElasticSearch \Domain \Model \Mapping ;
18+ use Flowpack \ElasticSearch \Transfer \Exception \ApiException ;
19+ use Symfony \Component \Yaml \Yaml ;
1620use TYPO3 \Flow \Annotations as Flow ;
1721use TYPO3 \Flow \Cli \CommandController ;
22+ use TYPO3 \Flow \Configuration \ConfigurationManager ;
23+ use TYPO3 \Flow \Object \ObjectManagerInterface ;
1824use TYPO3 \Neos \Controller \CreateContentContextTrait ;
1925use TYPO3 \TYPO3CR \Domain \Model \Workspace ;
26+ use TYPO3 \TYPO3CR \Domain \Repository \NodeDataRepository ;
27+ use TYPO3 \TYPO3CR \Domain \Repository \WorkspaceRepository ;
28+ use TYPO3 \TYPO3CR \Domain \Service \ContentDimensionPresetSourceInterface ;
29+ use TYPO3 \TYPO3CR \Search \Indexer \NodeIndexerInterface ;
2030
2131/**
2232 * Provides CLI features for index handling
@@ -30,19 +40,19 @@ class NodeIndexCommandController extends CommandController
3040
3141 /**
3242 * @Flow\Inject
33- * @var \TYPO3\TYPO3CR\Search\Indexer\ NodeIndexerInterface
43+ * @var NodeIndexerInterface
3444 */
3545 protected $ nodeIndexer ;
3646
3747 /**
3848 * @Flow\Inject
39- * @var \TYPO3\TYPO3CR\Domain\Repository\ WorkspaceRepository
49+ * @var WorkspaceRepository
4050 */
4151 protected $ workspaceRepository ;
4252
4353 /**
4454 * @Flow\Inject
45- * @var \TYPO3\TYPO3CR\Domain\Repository\ NodeDataRepository
55+ * @var NodeDataRepository
4656 */
4757 protected $ nodeDataRepository ;
4858
@@ -54,7 +64,7 @@ class NodeIndexCommandController extends CommandController
5464
5565 /**
5666 * @Flow\Inject
57- * @var \TYPO3\TYPO3CR\Domain\Service\ ContentDimensionPresetSourceInterface
67+ * @var ContentDimensionPresetSourceInterface
5868 */
5969 protected $ contentDimensionPresetSource ;
6070
@@ -66,13 +76,13 @@ class NodeIndexCommandController extends CommandController
6676
6777 /**
6878 * @Flow\Inject
69- * @var \Flowpack\ElasticSearch\ContentRepositoryAdaptor\ LoggerInterface
79+ * @var LoggerInterface
7080 */
7181 protected $ logger ;
7282
7383 /**
7484 * @Flow\Inject
75- * @var \TYPO3\Flow\Configuration\ ConfigurationManager
85+ * @var ConfigurationManager
7686 */
7787 protected $ configurationManager ;
7888
@@ -88,8 +98,8 @@ class NodeIndexCommandController extends CommandController
8898 */
8999 public function initializeObject ($ cause )
90100 {
91- if ($ cause === \ TYPO3 \ Flow \ Object \ ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED ) {
92- $ this ->settings = $ this ->configurationManager ->getConfiguration (\ TYPO3 \ Flow \ Configuration \ ConfigurationManager::CONFIGURATION_TYPE_SETTINGS , 'TYPO3.TYPO3CR.Search ' );
101+ if ($ cause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED ) {
102+ $ this ->settings = $ this ->configurationManager ->getConfiguration (ConfigurationManager::CONFIGURATION_TYPE_SETTINGS , 'TYPO3.TYPO3CR.Search ' );
93103 }
94104 }
95105
@@ -102,8 +112,8 @@ public function showMappingCommand()
102112 {
103113 $ nodeTypeMappingCollection = $ this ->nodeTypeMappingBuilder ->buildMappingInformation ($ this ->nodeIndexer ->getIndex ());
104114 foreach ($ nodeTypeMappingCollection as $ mapping ) {
105- /** @var \Flowpack\ElasticSearch\Domain\Model\ Mapping $mapping */
106- $ this ->output (\ Symfony \ Component \ Yaml \ Yaml::dump ($ mapping ->asArray (), 5 , 2 ));
115+ /** @var Mapping $mapping */
116+ $ this ->output (Yaml::dump ($ mapping ->asArray (), 5 , 2 ));
107117 $ this ->outputLine ();
108118 }
109119 $ this ->outputLine ('------------ ' );
@@ -181,6 +191,7 @@ public function indexNodeCommand($identifier, $workspace = null)
181191 $ indexInWorkspace ($ identifier , $ workspace );
182192 }
183193 } else {
194+ /** @var Workspace $workspaceInstance */
184195 $ workspaceInstance = $ this ->workspaceRepository ->findByIdentifier ($ workspace );
185196 if ($ workspaceInstance === null ) {
186197 $ this ->outputLine ('The given workspace (%s) does not exist. ' , [$ workspace ]);
@@ -198,7 +209,7 @@ public function indexNodeCommand($identifier, $workspace = null)
198209 * @param integer $limit Amount of nodes to index at maximum
199210 * @param boolean $update if TRUE, do not throw away the index at the start. Should *only be used for development*.
200211 * @param string $workspace name of the workspace which should be indexed
201- * @param string $postfix Index postfix, index with the same postifix will be deleted if exist
212+ * @param string $postfix Index postfix, index with the same postfix will be deleted if exist
202213 * @return void
203214 */
204215 public function buildCommand ($ limit = null , $ update = false , $ workspace = null , $ postfix = null )
@@ -265,7 +276,7 @@ public function cleanupCommand()
265276 } else {
266277 $ this ->logger ->log ('Nothing to remove. ' );
267278 }
268- } catch (\ Flowpack \ ElasticSearch \ Transfer \ Exception \ ApiException $ exception ) {
279+ } catch (ApiException $ exception ) {
269280 $ response = json_decode ($ exception ->getResponse ());
270281 $ this ->logger ->log (sprintf ('Nothing removed. ElasticSearch responded with status %s, saying "%s: %s" ' , $ response ->status , $ response ->error ->type , $ response ->error ->reason ));
271282 }
0 commit comments