Skip to content

Commit f82ef40

Browse files
committed
Merge branch '3.0' into es-5-support
2 parents 2a36448 + d473e43 commit f82ef40

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

Classes/Eel/ElasticSearchQueryBuilder.php

Lines changed: 20 additions & 15 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;
@@ -616,7 +621,7 @@ public function count()
616621
public function fulltext($searchWord)
617622
{
618623
// We automatically enable result highlighting when doing fulltext searches. It is up to the user to use this information or not use it.
619-
$this->request->fulltext(json_encode($searchWord));
624+
$this->request->fulltext(trim(json_encode($searchWord), '"'));
620625
$this->request->highlight(150, 2);
621626

622627
return $this;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "typo3-flow-package",
44
"description": "This package provides functionality for using Elasticsearch on top of Neos.ContentRepository.Search",
55
"homepage": "http://flowpack.org/",
6-
"license": ["LGPL-3.0"],
6+
"license": ["LGPL-3.0-only"],
77
"require": {
88
"php": ">=5.5.0",
99

0 commit comments

Comments
 (0)