Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merge Algolia4 options into query parameters #891

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/Engines/Algolia4Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
9 changes: 3 additions & 6 deletions tests/Feature/Engines/Algolia4EngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down