diff --git a/src/Engines/Algolia4Engine.php b/src/Engines/Algolia4Engine.php index 2327e224..17bbda1c 100644 --- a/src/Engines/Algolia4Engine.php +++ b/src/Engines/Algolia4Engine.php @@ -155,12 +155,11 @@ protected function performSearch(Builder $builder, array $options = []) ); } - $queryParams = ['query' => $builder->query]; + $queryParams = array_merge(['query' => $builder->query], $options); return $this->algolia->searchSingleIndex( $builder->index ?: $builder->model->searchableAs(), - $queryParams, - $options + $queryParams ); } } diff --git a/tests/Feature/Engines/Algolia4EngineTest.php b/tests/Feature/Engines/Algolia4EngineTest.php index 3c02de3c..f13d8be5 100644 --- a/tests/Feature/Engines/Algolia4EngineTest.php +++ b/tests/Feature/Engines/Algolia4EngineTest.php @@ -108,8 +108,7 @@ public function test_search_sends_correct_parameters_to_algolia() $this->client->shouldReceive('searchSingleIndex')->once()->with( 'users', - ['query' => 'zonda'], - ['numericFilters' => ['foo=1']] + ['query' => 'zonda', 'numericFilters' => ['foo=1']], ); $builder = new Builder(new SearchableUser, 'zonda'); @@ -124,8 +123,7 @@ public function test_search_sends_correct_parameters_to_algolia_for_where_in_sea $this->client->shouldReceive('searchSingleIndex')->once()->with( 'users', - ['query' => 'zonda'], - ['numericFilters' => ['foo=1', ['bar=1', 'bar=2']]], + ['query' => 'zonda', 'numericFilters' => ['foo=1', ['bar=1', 'bar=2']]], ); $builder = new Builder(new SearchableUser, 'zonda'); @@ -140,8 +138,7 @@ public function test_search_sends_correct_parameters_to_algolia_for_empty_where_ $this->client->shouldReceive('searchSingleIndex')->once()->with( 'users', - ['query' => 'zonda'], - ['numericFilters' => ['foo=1', '0=1']] + ['query' => 'zonda', 'numericFilters' => ['foo=1', '0=1']], ); $builder = new Builder(new SearchableUser, 'zonda');