@@ -45,7 +45,7 @@ class Config implements ClientOptionsInterface
45
45
protected $ scopeConfig ;
46
46
47
47
/**
48
- * @var string|null
48
+ * @var string
49
49
*/
50
50
private $ prefix ;
51
51
@@ -83,7 +83,7 @@ public function __construct(
83
83
$ this ->scopeConfig = $ scopeConfig ;
84
84
$ this ->clientResolver = $ clientResolver ;
85
85
$ this ->engineResolver = $ engineResolver ;
86
- $ this ->prefix = $ prefix ;
86
+ $ this ->prefix = $ prefix ?: $ this -> clientResolver -> getCurrentEngine () ;
87
87
$ this ->engineList = $ engineList ;
88
88
}
89
89
@@ -101,7 +101,7 @@ public function prepareClientOptions($options = [])
101
101
'enableAuth ' => $ this ->getElasticsearchConfigData ('enable_auth ' ),
102
102
'username ' => $ this ->getElasticsearchConfigData ('username ' ),
103
103
'password ' => $ this ->getElasticsearchConfigData ('password ' ),
104
- 'timeout ' => $ this ->getElasticsearchConfigData ('server_timeout ' ) ?: self ::ELASTICSEARCH_DEFAULT_TIMEOUT ,
104
+ 'timeout ' => $ this ->getElasticsearchConfigData ('server_timeout ' ) ? : self ::ELASTICSEARCH_DEFAULT_TIMEOUT ,
105
105
];
106
106
$ options = array_merge ($ defaultOptions , $ options );
107
107
$ allowedOptions = array_merge (array_keys ($ defaultOptions ), ['engine ' ]);
@@ -125,9 +125,7 @@ function (string $key) use ($allowedOptions) {
125
125
*/
126
126
public function getElasticsearchConfigData ($ field , $ storeId = null )
127
127
{
128
- $ searchEngine = $ this ->prefix ?: $ this ->clientResolver ->getCurrentEngine ();
129
-
130
- return $ this ->getSearchConfigData ($ searchEngine . '_ ' . $ field , $ storeId );
128
+ return $ this ->getSearchConfigData ($ this ->prefix . '_ ' . $ field , $ storeId );
131
129
}
132
130
133
131
/**
0 commit comments