Skip to content

Commit 4cdff49

Browse files
authored
Add mixed filterable attributes example (#734)
1 parent 705a3ad commit 4cdff49

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.code-samples.meilisearch.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,17 @@ get_filterable_attributes_1: |-
262262
$client->index('movies')->getFilterableAttributes();
263263
update_filterable_attributes_1: |-
264264
$client->index('movies')->updateFilterableAttributes([
265-
'genres',
266-
'director'
265+
'author',
266+
[
267+
'attributePatterns' => ['genres'],
268+
'features' => [
269+
'facetSearch' => true,
270+
'filter' => [
271+
'equality' => true,
272+
'comparison' => false,
273+
],
274+
],
275+
],
267276
]);
268277
reset_filterable_attributes_1: |-
269278
$client->index('movies')->resetFilterableAttributes();

src/Endpoints/Delegates/HandlesSettings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function resetSynonyms(): array
222222
// Settings - Filterable Attributes
223223

224224
/**
225-
* @return list<non-empty-string>|list<array{
225+
* @return list<non-empty-string|array{
226226
* attributePatterns: list<non-empty-string>,
227227
* features?: array{
228228
* facetSearch: bool,
@@ -236,7 +236,7 @@ public function getFilterableAttributes(): array
236236
}
237237

238238
/**
239-
* @param list<non-empty-string>|list<array{
239+
* @param list<non-empty-string|array{
240240
* attributePatterns: list<non-empty-string>,
241241
* features?: array{facetSearch: bool, filter: array{equality: bool, comparison: bool}}
242242
* }> $filterableAttributes

tests/Settings/FilterableAttributesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function testUpdateGranularFilterableAttributes(): void
5555
$index = $this->createEmptyIndex($this->safeIndexName());
5656

5757
$expectedAttributes = [
58+
'author',
5859
[
5960
'attributePatterns' => ['title'],
6061
'features' => [

0 commit comments

Comments
 (0)