Skip to content

Commit d30d2d7

Browse files
committed
TASK: Adpat to interface changes of Neos.ContentRepository.Search
1 parent 59769a6 commit d30d2d7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Classes/Eel/ElasticSearchQueryBuilder.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class ElasticSearchQueryBuilder implements QueryBuilderInterface, ProtectedConte
122122
* @throws QueryBuildingException
123123
* @api
124124
*/
125-
public function nodeType($nodeType)
125+
public function nodeType(string $nodeType): QueryBuilderInterface
126126
{
127127
// on indexing, neos_type_and_supertypes contains the typename itself and all supertypes, so that's why we can
128128
// use a simple term filter here.
@@ -138,7 +138,7 @@ public function nodeType($nodeType)
138138
* @return ElasticSearchQueryBuilder
139139
* @api
140140
*/
141-
public function sortDesc($propertyName)
141+
public function sortDesc(string $propertyName): QueryBuilderInterface
142142
{
143143
$configuration = [
144144
$propertyName => ['order' => 'desc']
@@ -156,7 +156,7 @@ public function sortDesc($propertyName)
156156
* @return ElasticSearchQueryBuilder
157157
* @api
158158
*/
159-
public function sortAsc($propertyName)
159+
public function sortAsc(string $propertyName): QueryBuilderInterface
160160
{
161161
$configuration = [
162162
$propertyName => ['order' => 'asc']
@@ -194,7 +194,7 @@ public function sort($configuration): ElasticSearchQueryBuilder
194194
* @throws IllegalObjectTypeException
195195
* @api
196196
*/
197-
public function limit($limit)
197+
public function limit($limit): QueryBuilderInterface
198198
{
199199
if ($limit === null) {
200200
return $this;
@@ -222,7 +222,7 @@ public function limit($limit)
222222
* @return ElasticSearchQueryBuilder
223223
* @api
224224
*/
225-
public function from($from)
225+
public function from($from): QueryBuilderInterface
226226
{
227227
if (!$from) {
228228
return $this;
@@ -243,7 +243,7 @@ public function from($from)
243243
* @throws QueryBuildingException
244244
* @api
245245
*/
246-
public function exactMatch($propertyName, $value)
246+
public function exactMatch(string $propertyName, $value): QueryBuilderInterface
247247
{
248248
return $this->queryFilter('term', [$propertyName => $this->convertValue($value)]);
249249
}
@@ -620,9 +620,10 @@ protected function evaluateResult(array $result): SearchResult
620620
* Get a query result object for lazy execution of the query
621621
*
622622
* @return ElasticSearchQueryResult
623+
* @return \Traversable
623624
* @api
624625
*/
625-
public function execute()
626+
public function execute(): \Traversable
626627
{
627628
$elasticSearchQuery = new ElasticSearchQuery($this);
628629
return $elasticSearchQuery->execute(true);
@@ -649,7 +650,7 @@ public function executeUncached(): ElasticSearchQueryResult
649650
* @throws \Neos\Flow\Http\Exception
650651
* @api
651652
*/
652-
public function count()
653+
public function count(): int
653654
{
654655
$timeBefore = microtime(true);
655656
$request = $this->getRequest()->getCountRequestAsJson();
@@ -658,7 +659,7 @@ public function count()
658659
$timeAfterwards = microtime(true);
659660

660661
$treatedContent = $response->getTreatedContent();
661-
$count = $treatedContent['count'];
662+
$count = (int)$treatedContent['count'];
662663

663664
$this->logThisQuery && $this->logger->debug('Count Query Log (' . $this->logMessage . '): ' . $request . ' -- execution time: ' . (($timeAfterwards - $timeBefore) * 1000) . ' ms -- Total Results: ' . $count, LogEnvironment::fromMethodName(__METHOD__));
664665

@@ -797,7 +798,7 @@ public function moreLikeThis(array $like, array $fields = [], array $options = [
797798
* @throws IllegalObjectTypeException
798799
* @api
799800
*/
800-
public function query(NodeInterface $contextNode): ElasticSearchQueryBuilder
801+
public function query(NodeInterface $contextNode): QueryBuilderInterface
801802
{
802803
$this->elasticSearchClient->setContextNode($contextNode);
803804

Classes/Indexer/NodeIndexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ public function removeOldIndices(): array
665665
* @param callable $callback
666666
* @throws \Exception
667667
*/
668-
public function withBulkProcessing(callable $callback)
668+
public function withBulkProcessing(callable $callback): void
669669
{
670670
$bulkProcessing = $this->bulkProcessing;
671671
$this->bulkProcessing = true;

0 commit comments

Comments
 (0)