Skip to content

Commit

Permalink
elasticsearch version changed as 8.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hkulekci committed Oct 8, 2023
1 parent 7abd5eb commit 645ca21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

services:
elasticsearch:
image: elasticsearch:8.10.2
image: elasticsearch:8.4.2
ports:
- 9200:9200
env:
Expand Down
16 changes: 12 additions & 4 deletions src/SearchEndpoint/KnnEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ public function normalize(
$format = null,
array $context = []
): array|string|int|float|bool {
$output = [];
if (count($this->getAll()) > 0) {
$knns = $this->getAll();
if (count($knns) === 1) {
/** @var Knn $knn */
foreach ($this->getAll() as $knn) {
$knn = array_values($knns)[0];
return $knn->toArray();
}

if (count($knns) > 1) {
$output = [];
/** @var Knn $knn */
foreach ($knns as $knn) {
$output[] = $knn->toArray();
}
return $output;
}

return $output;
return [];
}
}

0 comments on commit 645ca21

Please sign in to comment.