@@ -73,6 +73,12 @@ class GraphIndexCommandController extends CommandController
73
73
*/
74
74
protected $ batchSize ;
75
75
76
+ /**
77
+ * @Flow\InjectConfiguration(path="indexing.displayProgress")
78
+ * @var bool
79
+ */
80
+ protected $ displayProgress ;
81
+
76
82
/**
77
83
* @var array
78
84
*/
@@ -95,40 +101,51 @@ public function initializeObject($cause)
95
101
* @param boolean $update if TRUE, do not throw away the index at the start. Should *only be used for development*.
96
102
* @param string $workspace name of the workspace which should be indexed
97
103
* @param string $postfix Index postfix, index with the same postifix will be deleted if exist
104
+ * @param bool $displayProgress
98
105
* @return void
99
106
* @throws ApiException
100
- * @throws \Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception
101
- * @throws \Neos\ContentRepository\Exception\NodeTypeNotFoundException
107
+ * @throws CRAException
102
108
*/
103
- public function buildCommand ($ limit = null , $ update = false , $ workspace = null , $ postfix = '' ): void
109
+ public function buildCommand ($ limit = null , $ update = false , $ workspace = null , $ postfix = '' , bool $ displayProgress = false ): void
104
110
{
111
+ $ displayProgress = $ displayProgress || $ this ->displayProgress ;
105
112
$ this ->createNewIndex ($ postfix );
106
113
$ this ->applyMapping ();
107
114
108
115
$ this ->logger ->log (sprintf ('Indexing %snodes ... ' , ($ limit !== null ? 'the first ' . $ limit . ' ' : '' )),
109
116
LOG_INFO );
110
117
111
118
$ this ->outputLine ('Initializing content graph... ' );
112
- $ graph = $ this ->graphService ->getContentGraph ($ this ->output );
119
+ if ($ displayProgress ) {
120
+ $ graph = $ this ->graphService ->getContentGraph ($ this ->output );
121
+ } else {
122
+ $ graph = $ this ->graphService ->getContentGraph ();
123
+ }
113
124
114
125
$ this ->outputLine ('Indexing content graph... ' );
115
126
$ time = time ();
116
- $ this ->output ->progressStart (count ($ graph ->getNodes ()));
127
+ if ($ displayProgress ) {
128
+ $ this ->output ->progressStart (count ($ graph ->getNodes ()));
129
+ }
117
130
$ indexedHierarchyRelations = 0 ;
118
131
$ nodesSinceLastFlush = 0 ;
119
132
$ this ->nodeIndexer ->setContentGraph ($ graph );
120
133
foreach ($ graph ->getNodes () as $ node ) {
121
134
$ this ->nodeIndexer ->indexGraphNode ($ node );
122
135
$ nodesSinceLastFlush ++;
123
136
$ indexedHierarchyRelations += count ($ node ->getIncomingHierarchyRelations ());
124
- $ this ->output ->progressAdvance ();
137
+ if ($ displayProgress ) {
138
+ $ this ->output ->progressAdvance ();
139
+ }
125
140
if ($ nodesSinceLastFlush >= $ this ->batchSize ) {
126
141
$ this ->nodeIndexer ->flush ();
127
142
$ nodesSinceLastFlush = 0 ;
128
143
}
129
144
}
130
145
$ this ->output ->progressFinish ();
131
- $ this ->nodeIndexer ->flush ();
146
+ if ($ displayProgress ) {
147
+ $ this ->nodeIndexer ->flush ();
148
+ }
132
149
$ timeSpent = time () - $ time ;
133
150
$ this ->logger ->log ('Done. Indexed ' . count ($ graph ->getNodes ()) . ' nodes and ' . $ indexedHierarchyRelations . ' edges in ' . $ timeSpent . ' s at ' . round (count ($ graph ->getNodes ()) / $ timeSpent ) . ' nodes/s ( ' . round ($ indexedHierarchyRelations / $ timeSpent ) . ' edges/s) ' ,
134
151
LOG_INFO );
0 commit comments