| @@ 194-211 (lines=18) @@ | ||
| 191 | } |
|
| 192 | } |
|
| 193 | ||
| 194 | public function refreshIndex(string $index_name) |
|
| 195 | { |
|
| 196 | if (! $this->isEnabled()) { |
|
| 197 | return; |
|
| 198 | } |
|
| 199 | ||
| 200 | $params = [ |
|
| 201 | 'index' => $index_name, |
|
| 202 | ]; |
|
| 203 | ||
| 204 | if (! empty($this->timeout)) { |
|
| 205 | $params['client'] = [ |
|
| 206 | 'timeout' => $this->timeout, |
|
| 207 | ]; |
|
| 208 | } |
|
| 209 | ||
| 210 | $this->client->indices()->refresh($params); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function performSearch(ElasticSearchQueryContract $query): array |
|
| 214 | { |
|
| @@ 213-229 (lines=17) @@ | ||
| 210 | $this->client->indices()->refresh($params); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function performSearch(ElasticSearchQueryContract $query): array |
|
| 214 | { |
|
| 215 | if (! $this->isEnabled()) { |
|
| 216 | return []; |
|
| 217 | } |
|
| 218 | ||
| 219 | $params = $query->build(); |
|
| 220 | if (! empty($this->timeout)) { |
|
| 221 | $params['client'] = [ |
|
| 222 | 'timeout' => $this->timeout, |
|
| 223 | ]; |
|
| 224 | } |
|
| 225 | ||
| 226 | $results = $this->client->search($params); |
|
| 227 | ||
| 228 | return $results; |
|
| 229 | } |
|
| 230 | ||
| 231 | public function switchIndexAlias(string $alias_name, string $index_name) |
|
| 232 | { |
|