Skip to content

Commit 35a203a

Browse files
committed
MC-20710: Add Elasticsearch configuration parameters to console
1 parent 0e0f0e5 commit 35a203a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

setup/src/Magento/Setup/Model/SearchConfig.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ public function __construct(
4848
public function saveConfiguration(array $inputOptions)
4949
{
5050
$searchConfigOptions = $this->extractSearchOptions($inputOptions);
51-
$this->validateSearchEngineSelection($searchConfigOptions);
51+
if (!empty($searchConfigOptions[SearchConfigOptionsList::INPUT_KEY_SEARCH_ENGINE])) {
52+
$this->validateSearchEngineSelection($searchConfigOptions);
5253

53-
try {
54-
$this->installConfig->configure($searchConfigOptions);
55-
} catch (InputException $e) {
56-
throw new SetupException($e->getMessage());
54+
try {
55+
$this->installConfig->configure($searchConfigOptions);
56+
} catch (InputException $e) {
57+
throw new SetupException($e->getMessage());
58+
}
5759
}
5860
}
5961

@@ -65,9 +67,11 @@ public function saveConfiguration(array $inputOptions)
6567
*/
6668
private function validateSearchEngineSelection(array $searchOptions)
6769
{
68-
$selectedEngine = $searchOptions[SearchConfigOptionsList::INPUT_KEY_SEARCH_ENGINE];
69-
if (!in_array($selectedEngine, SearchConfigOptionsList::AVAILABLE_SEARCH_ENGINES)) {
70-
throw new SetupException("Search engine '{$selectedEngine}' is not an available search engine.");
70+
if (isset($searchOptions[SearchConfigOptionsList::INPUT_KEY_SEARCH_ENGINE])) {
71+
$selectedEngine = $searchOptions[SearchConfigOptionsList::INPUT_KEY_SEARCH_ENGINE];
72+
if (!in_array($selectedEngine, SearchConfigOptionsList::AVAILABLE_SEARCH_ENGINES)) {
73+
throw new SetupException("Search engine '{$selectedEngine}' is not an available search engine.");
74+
}
7175
}
7276
}
7377

0 commit comments

Comments
 (0)