Skip to content

Commit dabe61f

Browse files
authored
fix: merge options into query parameters for Algolia4 search (#891)
1 parent a4c48ac commit dabe61f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Engines/Algolia4Engine.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,11 @@ protected function performSearch(Builder $builder, array $options = [])
155155
);
156156
}
157157

158-
$queryParams = ['query' => $builder->query];
158+
$queryParams = array_merge(['query' => $builder->query], $options);
159159

160160
return $this->algolia->searchSingleIndex(
161161
$builder->index ?: $builder->model->searchableAs(),
162-
$queryParams,
163-
$options
162+
$queryParams
164163
);
165164
}
166165
}

tests/Feature/Engines/Algolia4EngineTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ public function test_search_sends_correct_parameters_to_algolia()
108108

109109
$this->client->shouldReceive('searchSingleIndex')->once()->with(
110110
'users',
111-
['query' => 'zonda'],
112-
['numericFilters' => ['foo=1']]
111+
['query' => 'zonda', 'numericFilters' => ['foo=1']],
113112
);
114113

115114
$builder = new Builder(new SearchableUser, 'zonda');
@@ -124,8 +123,7 @@ public function test_search_sends_correct_parameters_to_algolia_for_where_in_sea
124123

125124
$this->client->shouldReceive('searchSingleIndex')->once()->with(
126125
'users',
127-
['query' => 'zonda'],
128-
['numericFilters' => ['foo=1', ['bar=1', 'bar=2']]],
126+
['query' => 'zonda', 'numericFilters' => ['foo=1', ['bar=1', 'bar=2']]],
129127
);
130128

131129
$builder = new Builder(new SearchableUser, 'zonda');
@@ -140,8 +138,7 @@ public function test_search_sends_correct_parameters_to_algolia_for_empty_where_
140138

141139
$this->client->shouldReceive('searchSingleIndex')->once()->with(
142140
'users',
143-
['query' => 'zonda'],
144-
['numericFilters' => ['foo=1', '0=1']]
141+
['query' => 'zonda', 'numericFilters' => ['foo=1', '0=1']],
145142
);
146143

147144
$builder = new Builder(new SearchableUser, 'zonda');

0 commit comments

Comments
 (0)