From 3dceb5292f30fae67140669223f4879f480a464b Mon Sep 17 00:00:00 2001 From: maryamsulemani97 Date: Mon, 30 Jan 2023 12:32:08 +0400 Subject: [PATCH 1/2] update `displayed_searchable_attributes.md` --- .code-samples.meilisearch.yaml | 20 ++++------ .../displayed_searchable_attributes.md | 40 +++++++++---------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index f52df5f960..754ab197a3 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -312,32 +312,28 @@ get_version_1: |- -X GET 'http://localhost:7700/version' distinct_attribute_guide_1: |- curl \ - -X PATCH 'http://localhost:7700/indexes/jackets/settings' \ + -X PUT 'http://localhost:7700/indexes/jackets/settings/distinct-attribute' \ -H 'Content-Type: application/json' \ - --data-binary '{ "distinctAttribute": "product_id" }' + --data-binary '"product_id"' field_properties_guide_searchable_1: |- curl \ - -X PATCH 'http://localhost:7700/indexes/movies/settings' \ + -X PUT 'http://localhost:7700/indexes/movies/settings/searchable-attributes' \ -H 'Content-Type: application/json' \ - --data-binary '{ - "searchableAttributes": [ + --data-binary '[ "title", "overview", "genres" - ] - }' + ]' field_properties_guide_displayed_1: |- curl \ - -X PATCH 'http://localhost:7700/indexes/movies/settings' \ + -X PUT 'http://localhost:7700/indexes/movies/settings/displayed-attributes' \ -H 'Content-Type: application/json' \ - --data-binary '{ - "displayedAttributes": [ + --data-binary '[ "title", "overview", "genres", "release_date" - ] - }' + ]' filtering_guide_1: |- curl \ -X POST 'http://localhost:7700/indexes/movies/search' \ diff --git a/learn/configuration/displayed_searchable_attributes.md b/learn/configuration/displayed_searchable_attributes.md index fb165a5708..eea6bb9244 100644 --- a/learn/configuration/displayed_searchable_attributes.md +++ b/learn/configuration/displayed_searchable_attributes.md @@ -2,10 +2,28 @@ By default, whenever a document is added to Meilisearch, all new attributes found in it are automatically added to two lists: -- [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words - [`displayedAttributes`](/learn/configuration/displayed_searchable_attributes.md#displayed-fields): Attributes whose fields are displayed in documents +- [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words + +This means that by default, every field in a document is **displayed** and **searchable**. These properties can be modified in the [settings](/reference/api/settings.md). + +## Displayed fields + +The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**. + +Documents returned upon search contain only displayed fields. + +**By default, all field attributes are set as displayed**. + +Therefore, if a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents. + +This list can be restricted to a selected set of attributes in the settings. + +#### Example + +Suppose you manage a database that contains information about movies. By adding the following settings, documents returned upon search will contain the fields `title`, `overview`, `release_date` and `genres`. -This means that by default, every field in a document is **searchable** and **displayed**. These properties can be modified in the [settings](/reference/api/settings.md). + ## Searchable fields @@ -54,24 +72,6 @@ Suppose that you manage a database of movies with the following fields: `id`, `o -## Displayed fields - -The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**. - -Documents returned upon search contain only displayed fields. - -**By default, all field attributes are set as displayed**. - -Therefore, if a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents. - -This list can be restricted to a selected set of attributes in the settings. - -#### Example - -Suppose you manage a database that contains information about movies. By adding the following settings, documents returned upon search will contain the fields `title`, `overview`, `release_date` and `genres`. - - - ## Data storing All fields are stored in the database. **This behavior cannot be changed**. From adbb0696e9ce274036c4526352e904f59130eec9 Mon Sep 17 00:00:00 2001 From: Maryam <90181761+maryamsulemani97@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:53:37 +0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: gui machiavelli --- learn/configuration/displayed_searchable_attributes.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/learn/configuration/displayed_searchable_attributes.md b/learn/configuration/displayed_searchable_attributes.md index eea6bb9244..fc32dfdea4 100644 --- a/learn/configuration/displayed_searchable_attributes.md +++ b/learn/configuration/displayed_searchable_attributes.md @@ -5,20 +5,16 @@ By default, whenever a document is added to Meilisearch, all new attributes foun - [`displayedAttributes`](/learn/configuration/displayed_searchable_attributes.md#displayed-fields): Attributes whose fields are displayed in documents - [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words -This means that by default, every field in a document is **displayed** and **searchable**. These properties can be modified in the [settings](/reference/api/settings.md). +By default, every field in a document is **displayed** and **searchable**. These properties can be modified in the [settings](/reference/api/settings.md). ## Displayed fields The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**. -Documents returned upon search contain only displayed fields. +Documents returned upon search contain only displayed fields. If a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents. **By default, all field attributes are set as displayed**. -Therefore, if a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents. - -This list can be restricted to a selected set of attributes in the settings. - #### Example Suppose you manage a database that contains information about movies. By adding the following settings, documents returned upon search will contain the fields `title`, `overview`, `release_date` and `genres`.