diff --git a/Builder/ArticleIndexBuilder.php b/Builder/ArticleIndexBuilder.php
new file mode 100644
index 000000000..ef73d176d
--- /dev/null
+++ b/Builder/ArticleIndexBuilder.php
@@ -0,0 +1,71 @@
+buildForManager($this->container->get('es.manager.live'), $this->input->getOption('destroy'));
+ $this->buildForManager($this->container->get('es.manager.default'), $this->input->getOption('destroy'));
+ }
+
+ /**
+ * Build index for given manager.
+ *
+ * If index not exists - it will be created.
+ * If index exists and destroy flag is true - drop and create index.
+ * Else do nothing.
+ *
+ * @param Manager $manager
+ * @param bool $destroy
+ */
+ private function buildForManager(Manager $manager, $destroy)
+ {
+ if (!$manager->indexExists()) {
+ $manager->createIndex();
+
+ return;
+ }
+
+ if (!$destroy) {
+ return;
+ }
+
+ $manager->dropAndCreateIndex();
+ }
+}
diff --git a/DependencyInjection/SuluArticleExtension.php b/DependencyInjection/SuluArticleExtension.php
index 80ab70bcd..4200076d7 100644
--- a/DependencyInjection/SuluArticleExtension.php
+++ b/DependencyInjection/SuluArticleExtension.php
@@ -124,6 +124,31 @@ public function prepend(ContainerBuilder $container)
]
);
}
+
+ if ($container->hasExtension('massive_build')) {
+ $container->prependExtensionConfig(
+ 'massive_build',
+ [
+ 'targets' => [
+ 'prod' => [
+ 'dependencies' => [
+ 'article_index' => [],
+ ],
+ ],
+ 'dev' => [
+ 'dependencies' => [
+ 'article_index' => [],
+ ],
+ ],
+ 'maintain' => [
+ 'dependencies' => [
+ 'article_index' => [],
+ ],
+ ],
+ ],
+ ]
+ );
+ }
}
/**
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 26189448a..0902023c3 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -327,5 +327,9 @@
+
+
+
+