From 5ef6472eb997f48ce92d447d51487047d66bce26 Mon Sep 17 00:00:00 2001 From: Maryam Sulemani Date: Thu, 30 Jun 2022 16:29:34 +0400 Subject: [PATCH 1/5] add faceting to index settings+core concepts --- .code-samples.meilisearch.yaml | 7 +++++++ .vuepress/public/sample-template.yaml | 1 + learn/configuration/settings.md | 17 +++++++++++++++++ learn/core_concepts/indexes.md | 9 +++++++++ 4 files changed, 34 insertions(+) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index d121406c65..713c11ba24 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -974,3 +974,10 @@ update_faceting_settings_1: |- reset_faceting_settings_1: |- curl \ -X DELETE 'http://localhost:7700/indexes/books/settings/faceting' +settings_guide_faceting_1: |- + curl \ + -X PATCH 'http://localhost:7700/indexes/movies/settings/faceting' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "maxValuesPerFacet": 5 + }' diff --git a/.vuepress/public/sample-template.yaml b/.vuepress/public/sample-template.yaml index 44f0a2d788..d5d9486bea 100644 --- a/.vuepress/public/sample-template.yaml +++ b/.vuepress/public/sample-template.yaml @@ -149,3 +149,4 @@ getting_started_typo_tolerance: |- get_faceting_settings_1: |- update_faceting_settings_1: |- reset_faceting_settings_1: |- +settings_guide_faceting_1: |- diff --git a/learn/configuration/settings.md b/learn/configuration/settings.md index a0380f432d..2b7a69e834 100644 --- a/learn/configuration/settings.md +++ b/learn/configuration/settings.md @@ -7,6 +7,7 @@ This page describes the **index-level settings** available in Meilisearch and ho | **[displayedAttributes](/learn/configuration/settings.md#displayed-attributes)** | Fields displayed in the returned documents | All attributes found in the documents | | **[distinctAttribute](/learn/configuration/settings.md#distinct-attribute)** | Search returns documents with distinct (different) values of the given field | `null` | | **[filterableAttributes](/learn/configuration/settings.md#filterable-attributes)** | List of attributes that can be used for filtering | `null` | +| **[faceting](/learn/advanced/filtering_and_faceted_search.md)** | Faceting settings | `{}` | **[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) | | **[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 | | | **[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 +## Faceting + +The faceting settings of an index. Facets are specific uses-cases of filters, depending on your UI and UX design. + +::: tip +Like filters, you need to add your facets to `filterableAttributes` in order to use the [`filter`](/reference/api/search.md#filter) search parameter. +::: + +[Learn more about faceting](/learn/advanced/filtering_and_faceted_search.md) + +#### Example + +The following code sample will return a maximum of 5 facet values for each facet in the `movies` index: + + + ## Ranking rules 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. diff --git a/learn/core_concepts/indexes.md b/learn/core_concepts/indexes.md index 36f069949e..4fe56dcc91 100644 --- a/learn/core_concepts/indexes.md +++ b/learn/core_concepts/indexes.md @@ -59,6 +59,7 @@ You can customize the following index settings: - [Stop words](#stop-words) - [Displayed and searchable attributes](#displayed-and-searchable-attributes) - [Typo tolerance](#typo-tolerance) +- [Faceting](#faceting) 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). @@ -130,3 +131,11 @@ Typo tolerance is a built-in feature that helps you find relevant results even w 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). [Learn more about typo tolerance](/learn/configuration/typo_tolerance.md) + +### Faceting + +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). + +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). + +[Learn more about faceting](/learn/advanced/filtering_and_faceted_search.md) From 19ea1d7cbaacbc1d567aef9d990bd69ab1c29ad5 Mon Sep 17 00:00:00 2001 From: Maryam <90181761+maryamsulemani97@users.noreply.github.com> Date: Thu, 30 Jun 2022 17:22:13 +0400 Subject: [PATCH 2/5] Update learn/configuration/settings.md --- learn/configuration/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn/configuration/settings.md b/learn/configuration/settings.md index 2b7a69e834..f16d0e3679 100644 --- a/learn/configuration/settings.md +++ b/learn/configuration/settings.md @@ -98,7 +98,7 @@ To be able to filter search results on `director` and `genres` in a movie databa ## Faceting -The faceting settings of an index. Facets are specific uses-cases of filters, depending on your UI and UX design. +The faceting settings of an index. Facets are specific use-cases of filters that can be used to refine search results. ::: tip Like filters, you need to add your facets to `filterableAttributes` in order to use the [`filter`](/reference/api/search.md#filter) search parameter. From 3d04d72327186fb2b4327dd4c02e38e0771bd672 Mon Sep 17 00:00:00 2001 From: Maryam <90181761+maryamsulemani97@users.noreply.github.com> Date: Thu, 30 Jun 2022 17:24:08 +0400 Subject: [PATCH 3/5] Update settings.md --- learn/configuration/settings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/learn/configuration/settings.md b/learn/configuration/settings.md index f16d0e3679..b31a0094f2 100644 --- a/learn/configuration/settings.md +++ b/learn/configuration/settings.md @@ -101,14 +101,14 @@ To be able to filter search results on `director` and `genres` in a movie databa The faceting settings of an index. Facets are specific use-cases of filters that can be used to refine search results. ::: tip -Like filters, you need to add your facets to `filterableAttributes` in order to use the [`filter`](/reference/api/search.md#filter) search parameter. +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. ::: [Learn more about faceting](/learn/advanced/filtering_and_faceted_search.md) #### Example -The following code sample will return a maximum of 5 facet values for each facet in the `movies` index: +The following code sample will return a maximum of `5` facet values for each facet in the `movies` index: From 8118fb5932216d028f451f9f406bad9c4289812b Mon Sep 17 00:00:00 2001 From: Maryam <90181761+maryamsulemani97@users.noreply.github.com> Date: Thu, 30 Jun 2022 17:24:22 +0400 Subject: [PATCH 4/5] Update learn/core_concepts/indexes.md --- learn/core_concepts/indexes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn/core_concepts/indexes.md b/learn/core_concepts/indexes.md index 4fe56dcc91..b99b04a563 100644 --- a/learn/core_concepts/indexes.md +++ b/learn/core_concepts/indexes.md @@ -136,6 +136,6 @@ You can update the typo tolerance settings using the [update settings endpoint]( 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). -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). +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). [Learn more about faceting](/learn/advanced/filtering_and_faceted_search.md) From 247c993b49326450a31da8a6eb8e467cb5ef04e9 Mon Sep 17 00:00:00 2001 From: Maryam <90181761+maryamsulemani97@users.noreply.github.com> Date: Sun, 3 Jul 2022 15:02:11 +0400 Subject: [PATCH 5/5] Update learn/core_concepts/indexes.md Co-authored-by: gui machiavelli --- learn/core_concepts/indexes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn/core_concepts/indexes.md b/learn/core_concepts/indexes.md index b99b04a563..97a7361af5 100644 --- a/learn/core_concepts/indexes.md +++ b/learn/core_concepts/indexes.md @@ -134,7 +134,7 @@ You can update the typo tolerance settings using the [update settings endpoint]( ### Faceting -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). +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). 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).