Skip to content

Commit d1a3383

Browse files
Merge #2132
2132: update `displayed_searchable_attributes.md` r=maryamsulemani97 a=maryamsulemani97 closes #2047 This PR also updates the page so that the settings are in alphabetical order. Co-authored-by: maryamsulemani97 <[email protected]> Co-authored-by: Maryam <[email protected]>
2 parents a4226f6 + adbb069 commit d1a3383

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

.code-samples.meilisearch.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,32 +312,28 @@ get_version_1: |-
312312
-X GET 'http://localhost:7700/version'
313313
distinct_attribute_guide_1: |-
314314
curl \
315-
-X PATCH 'http://localhost:7700/indexes/jackets/settings' \
315+
-X PUT 'http://localhost:7700/indexes/jackets/settings/distinct-attribute' \
316316
-H 'Content-Type: application/json' \
317-
--data-binary '{ "distinctAttribute": "product_id" }'
317+
--data-binary '"product_id"'
318318
field_properties_guide_searchable_1: |-
319319
curl \
320-
-X PATCH 'http://localhost:7700/indexes/movies/settings' \
320+
-X PUT 'http://localhost:7700/indexes/movies/settings/searchable-attributes' \
321321
-H 'Content-Type: application/json' \
322-
--data-binary '{
323-
"searchableAttributes": [
322+
--data-binary '[
324323
"title",
325324
"overview",
326325
"genres"
327-
]
328-
}'
326+
]'
329327
field_properties_guide_displayed_1: |-
330328
curl \
331-
-X PATCH 'http://localhost:7700/indexes/movies/settings' \
329+
-X PUT 'http://localhost:7700/indexes/movies/settings/displayed-attributes' \
332330
-H 'Content-Type: application/json' \
333-
--data-binary '{
334-
"displayedAttributes": [
331+
--data-binary '[
335332
"title",
336333
"overview",
337334
"genres",
338335
"release_date"
339-
]
340-
}'
336+
]'
341337
filtering_guide_1: |-
342338
curl \
343339
-X POST 'http://localhost:7700/indexes/movies/search' \

learn/configuration/displayed_searchable_attributes.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22

33
By default, whenever a document is added to Meilisearch, all new attributes found in it are automatically added to two lists:
44

5-
- [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words
65
- [`displayedAttributes`](/learn/configuration/displayed_searchable_attributes.md#displayed-fields): Attributes whose fields are displayed in documents
6+
- [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words
7+
8+
By default, every field in a document is **displayed** and **searchable**. These properties can be modified in the [settings](/reference/api/settings.md).
9+
10+
## Displayed fields
11+
12+
The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**.
13+
14+
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.
715

8-
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).
16+
**By default, all field attributes are set as displayed**.
17+
18+
#### Example
19+
20+
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`.
21+
22+
<CodeSamples id="field_properties_guide_displayed_1" />
923

1024
## Searchable fields
1125

@@ -54,24 +68,6 @@ Suppose that you manage a database of movies with the following fields: `id`, `o
5468

5569
<CodeSamples id="field_properties_guide_searchable_1" />
5670

57-
## Displayed fields
58-
59-
The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**.
60-
61-
Documents returned upon search contain only displayed fields.
62-
63-
**By default, all field attributes are set as displayed**.
64-
65-
Therefore, if a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents.
66-
67-
This list can be restricted to a selected set of attributes in the settings.
68-
69-
#### Example
70-
71-
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`.
72-
73-
<CodeSamples id="field_properties_guide_displayed_1" />
74-
7571
## Data storing
7672

7773
All fields are stored in the database. **This behavior cannot be changed**.

0 commit comments

Comments
 (0)