From 3e3bcd2a590ba9d6bba815b1efcc7de6152dd321 Mon Sep 17 00:00:00 2001 From: Haydar KULEKCI Date: Sat, 3 Sep 2022 11:01:05 +0300 Subject: [PATCH 1/3] raw search sample fixed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89049bb3..ee9c3a67 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ $results = Product::search('zonga', function($client, $body) { $body->addAggregation($minPriceAggregation); $body->addAggregation($brandTermAggregation); - return $client->search(['index' => 'products', 'body' => $body->toArray()]); + return $client->search(['index' => 'products', 'body' => $body->toArray()])->asArray(); })->raw(); ``` From 114f207d2e4377aa7133092c8d56fc2853135033 Mon Sep 17 00:00:00 2001 From: Haydar KULEKCI Date: Sun, 4 Sep 2022 08:00:32 +0300 Subject: [PATCH 2/3] fix for the dependency requirement for the "php-http/async-client-implementation" implementation --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 993594b4..fc4abd96 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,7 @@ "laravel/legacy-factories": "^1.0", "nunomaduro/larastan": "~0.6", "orchestra/testbench": "^6.18", + "php-http/guzzle7-adapter": "^1.0", "phpunit/phpunit": "~9.4.0" }, "autoload-dev": { From f51db58e1bcaf6f9b4c7f9b29e33ccd780ba7001 Mon Sep 17 00:00:00 2001 From: Haydar KULEKCI Date: Sun, 4 Sep 2022 23:44:07 +0300 Subject: [PATCH 3/3] tests fixed for the raw search result --- tests/Feature/ElasticSearchEngineTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Feature/ElasticSearchEngineTest.php b/tests/Feature/ElasticSearchEngineTest.php index edb258ae..e520831e 100644 --- a/tests/Feature/ElasticSearchEngineTest.php +++ b/tests/Feature/ElasticSearchEngineTest.php @@ -22,8 +22,10 @@ public function test_pass_empty_response(): void Artisan::call('scout:import'); $results = Product::search('Quia', static function ($client, $body) { - return $client->search(['index' => 'products', 'body' => $body->toArray()]); + return $client->search(['index' => 'products', 'body' => $body->toArray()])->asArray(); })->raw(); + + $this->assertIsArray($results); $this->assertEmpty($results['hits']['hits']); } @@ -39,9 +41,10 @@ public function test_pass_with_response(): void Artisan::call('scout:import'); $results = Product::search('iphone', static function ($client, $body) { - return $client->search(['index' => 'products', 'body' => $body->toArray()]); + return $client->search(['index' => 'products', 'body' => $body->toArray()])->asArray(); })->raw(); + $this->assertIsArray($results); $this->assertNotEmpty($results['hits']['hits']); } }