Skip to content

Commit 471b896

Browse files
Update learn/ai_powered_search/document_template_best_practices.mdx
1 parent 97060ce commit 471b896

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

learn/ai_powered_search/document_template_best_practices.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ Short prompts do not have enough information for the embedder to properly unders
5858

5959
## Add guards for missing fields
6060

61-
When building your `documentTemplate`, some documents might not contain all the fields you expect. For example, a movie record could be missing the `title` or `overview`. If your template directly references a missing field, it may raise an error.
61+
Some documents might not contain all the fields you expect. If your template directly references a missing field, Meilisearch will throw an error when indexing documents.
6262

63-
To prevent this, use Liquid’s `if` statements to add guards around fields. This ensures the template only includes data when it exists:
63+
To prevent this, use Liquid’s `if` statements to add guards around fields:
6464

6565
```
6666
{% if doc.title %}
6767
A movie called {{ doc.title }}
6868
{% endif %}
6969
```
7070

71-
This way, the prompt adapts to each document. If a field is missing, the embedder still receives a valid and useful prompt without errors.
71+
This ensures the template only tries to include data that already exists in a document. If a field is missing, the embedder still receives a valid and useful prompt without errors.
7272

7373
## Conclusion
7474

0 commit comments

Comments
 (0)