Skip to content

Commit be6cd5c

Browse files
v0.28: Add faceting to core concepts+index settings (#1767)
* add faceting to index settings+core concepts * Update learn/configuration/settings.md * Update settings.md * Update learn/core_concepts/indexes.md * Update learn/core_concepts/indexes.md Co-authored-by: gui machiavelli <[email protected]> Co-authored-by: gui machiavelli <[email protected]>
1 parent 3cf27c6 commit be6cd5c

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

.code-samples.meilisearch.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,3 +972,10 @@ update_faceting_settings_1: |-
972972
reset_faceting_settings_1: |-
973973
curl \
974974
-X DELETE 'http://localhost:7700/indexes/books/settings/faceting'
975+
settings_guide_faceting_1: |-
976+
curl \
977+
-X PATCH 'http://localhost:7700/indexes/movies/settings/faceting' \
978+
-H 'Content-Type: application/json' \
979+
--data-binary '{
980+
"maxValuesPerFacet": 5
981+
}'

.vuepress/public/sample-template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,4 @@ getting_started_typo_tolerance: |-
149149
get_faceting_settings_1: |-
150150
update_faceting_settings_1: |-
151151
reset_faceting_settings_1: |-
152+
settings_guide_faceting_1: |-

learn/configuration/settings.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This page describes the **index-level settings** available in Meilisearch and ho
77
| **[displayedAttributes](/learn/configuration/settings.md#displayed-attributes)** | Fields displayed in the returned documents | All attributes found in the documents |
88
| **[distinctAttribute](/learn/configuration/settings.md#distinct-attribute)** | Search returns documents with distinct (different) values of the given field | `null` |
99
| **[filterableAttributes](/learn/configuration/settings.md#filterable-attributes)** | List of attributes that can be used for filtering | `null` |
10+
| **[faceting](/learn/advanced/filtering_and_faceted_search.md)** | Faceting settings | `{}`
1011
| **[rankingRules](/learn/configuration/settings.md#ranking-rules)** | List of ranking rules sorted by order of importance | [A list of ordered built-in ranking rules](/learn/core_concepts/relevancy.md#built-in-rules) |
1112
| **[searchableAttributes](/learn/configuration/settings.md#searchable-attributes)** | Fields in which to search for matching query words sorted by order of importance | All attributes found in the documents | |
1213
| **[sortableAttributes](/learn/configuration/settings.md#sortable-attributes)** | List of attributes to use when sorting search results | `[]` |
@@ -95,6 +96,22 @@ To be able to filter search results on `director` and `genres` in a movie databa
9596

9697
<CodeSamples id="faceted_search_update_settings_1" />
9798

99+
## Faceting
100+
101+
The faceting settings of an index. Facets are specific use-cases of filters that can be used to refine search results.
102+
103+
::: tip
104+
Like filters, you need to add your facets to [`filterableAttributes`](/reference/api/filterable_attributes.md#update-filterable-attributes) in order to use the [`filter`](/reference/api/search.md#filter) search parameter.
105+
:::
106+
107+
[Learn more about faceting](/learn/advanced/filtering_and_faceted_search.md)
108+
109+
#### Example
110+
111+
The following code sample will return a maximum of `5` facet values for each facet in the `movies` index:
112+
113+
<CodeSamples id="settings_guide_faceting_1" />
114+
98115
## Ranking rules
99116

100117
Built-in ranking rules that **ensure relevancy in search results**. Ranking rules are applied in a default order which can be changed in the settings. You can add or remove rules and change their order of importance.

learn/core_concepts/indexes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ You can customize the following index settings:
5858
- [Stop words](#stop-words)
5959
- [Displayed and searchable attributes](#displayed-and-searchable-attributes)
6060
- [Typo tolerance](#typo-tolerance)
61+
- [Faceting](#faceting)
6162

6263
To change index settings, use the [update settings endpoint](/reference/api/settings.md#update-settings) or any of the [child routes](/reference/api/settings.md#all-settings).
6364

@@ -129,3 +130,11 @@ Typo tolerance is a built-in feature that helps you find relevant results even w
129130
You can update the typo tolerance settings using the [update settings endpoint](/reference/api/settings.md#update-settings) or the [update typo tolerance endpoint](/reference/api/typo_tolerance.md#update-typo-tolerance).
130131

131132
[Learn more about typo tolerance](/learn/configuration/typo_tolerance.md)
133+
134+
### Faceting
135+
136+
Facets are a specific use-case of filters in Meilisearch: whether something is a facet or filter depends on your UI and UX design. Like filters, you need to add your facets to [`filterableAttributes`](/reference/api/filterable_attributes.md#update-filterable-attributes), then make a search query using the [`filter` search parameter](/reference/api/search.md#filter).
137+
138+
By default, Meilisearch returns `100` facet values for each faceted field. You can change this using the [update settings endpoint](/reference/api/settings.md#update-settings) or the [update faceting settings endpoint](/reference/api/faceting.md#update-faceting-settings).
139+
140+
[Learn more about faceting](/learn/advanced/filtering_and_faceted_search.md)

0 commit comments

Comments
 (0)