Skip to content

Commit 9e9eb2f

Browse files
committed
MERGE: Merge branch '3.0' into master
2 parents bfd1cf1 + 0982dcc commit 9e9eb2f

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

Classes/Eel/ElasticSearchQueryBuilder.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -549,20 +549,25 @@ public function getFullElasticSearchHitForNode(NodeInterface $node)
549549
*/
550550
public function fetch()
551551
{
552-
$timeBefore = microtime(true);
553-
$request = $this->request->getRequestAsJson();
554-
$response = $this->elasticSearchClient->getIndex()->request('GET', '/_search', [], $request);
555-
$timeAfterwards = microtime(true);
556-
557-
$this->result = $response->getTreatedContent();
558-
559-
$this->result['nodes'] = [];
560-
if ($this->logThisQuery === true) {
561-
$this->logger->log(sprintf('Query Log (%s): %s -- execution time: %s ms -- Limit: %s -- Number of results returned: %s -- Total Results: %s',
562-
$this->logMessage, $request, (($timeAfterwards - $timeBefore) * 1000), $this->limit, count($this->result['hits']['hits']), $this->result['hits']['total']), LOG_DEBUG);
563-
}
564-
if (array_key_exists('hits', $this->result) && is_array($this->result['hits']) && count($this->result['hits']) > 0) {
565-
$this->result['nodes'] = $this->convertHitsToNodes($this->result['hits']);
552+
try {
553+
$timeBefore = microtime(true);
554+
$request = $this->request->getRequestAsJson();
555+
$response = $this->elasticSearchClient->getIndex()->request('GET', '/_search', [], $request);
556+
$timeAfterwards = microtime(true);
557+
558+
$this->result = $response->getTreatedContent();
559+
560+
$this->result['nodes'] = [];
561+
if ($this->logThisQuery === true) {
562+
$this->logger->log(sprintf('Query Log (%s): %s -- execution time: %s ms -- Limit: %s -- Number of results returned: %s -- Total Results: %s',
563+
$this->logMessage, $request, (($timeAfterwards - $timeBefore) * 1000), $this->limit, count($this->result['hits']['hits']), $this->result['hits']['total']), LOG_DEBUG);
564+
}
565+
if (array_key_exists('hits', $this->result) && is_array($this->result['hits']) && count($this->result['hits']) > 0) {
566+
$this->result['nodes'] = $this->convertHitsToNodes($this->result['hits']);
567+
}
568+
} catch (ApiException $exception) {
569+
$this->logger->logException($exception);
570+
$this->result['nodes'] = [];
566571
}
567572

568573
return $this->result;

0 commit comments

Comments
 (0)