Skip to content

Commit 6fe03bd

Browse files
add info on search personalization
1 parent a6c249e commit 6fe03bd

File tree

7 files changed

+88
-2
lines changed

7 files changed

+88
-2
lines changed

.code-samples.meilisearch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ analytics_event_conversion_1: |-
12951295
curl \
12961296
-X POST 'https://PROJECT_URL/events' \
12971297
-H 'Content-Type: application/json' \
1298-
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY'
1298+
-H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY' \
12991299
--data-binary '{
13001300
"eventType": "conversion",
13011301
"eventName": "Product Added To Cart",

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
{
192192
"group": "Personalization",
193193
"pages": [
194+
"learn/personalization/making_personalized_search_queries",
194195
"learn/personalization/search_personalization"
195196
]
196197
},
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Performing personalized search queries
3+
description: Search personalization uses context about the person performing the search to provide results more relevant to that specific user. This tutorial guides you through configuring and performing personalized search queries.
4+
---
5+
6+
## Requirements
7+
8+
- A Meilisearch project
9+
- Self-hosted Meilisearch users: a Cohere API key
10+
11+
## Activate personalized search
12+
13+
### Cloud users
14+
15+
Open a support ticket requesting Meilisearch to activate search personalization for your project.
16+
17+
### Self-hosted users
18+
19+
Relaunch your instance using the search personalization instance option:
20+
21+
```sh
22+
meilisearch --experimental-personalization-api-key="COHERE_API_KEY"
23+
```
24+
25+
## Generating user context
26+
27+
Search personalization requires a description about the user performing the search. Meilisearch does not currently provide automated generation of user context.
28+
29+
You’ll need to **generate a dynamically plain-text user description** for each search request. This should summarize relevant traits, such as:
30+
31+
- Category preferences like brand and size
32+
- Price sensitivity
33+
- Possible use cases
34+
- Other information regarding user interests
35+
36+
The re-ranking model is optimized to favor positive signals. For best results, focus on affirmatively stated preferences, behaviors, and affinities, such as "likes the color red" and "prefers cheaper brands" over "dislikes blue" and "is not interested in luxury brands".
37+
38+
## Perform a personalized search
39+
40+
Once search personalization is active and you have a pipeline in place to generate user profiles, you are ready to perform personalized searches.
41+
42+
Submit a search query and include the `personalize` search parameter in your query. `personalize` must be an object with a single field, `userContext`. Use the description in `userContext`:
43+
44+
```sh
45+
curl \
46+
-X POST 'MEILISEARCH_URL/indexes/INDEX_NAME/search' \
47+
-H 'Content-Type: application/json' \
48+
--data-binary '{
49+
"q": "wireless keyboard",
50+
"personalize": {
51+
"userContext": "The user prefers compact mechanical keyboards from Keychron or Logitech, with a mid-range budget and quiet keys for remote work."
52+
}
53+
}'
54+
```

learn/personalization/search_personalization.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ For example, in an e-commerce site, someone who often shops for sportswear might
2020

2121
## How can I enable search personalization in Meilisearch?
2222

23-
Search personalization is still in early development and not publicly available.
23+
Search personalization is an experimental feature.
24+
25+
If you are a Meilisearch Cloud user, contact support to activate it for your projects.
26+
27+
If you are self-hosting Meilisearch, relaunch it using the [search personalization instance option](/learn/self_hosted/configure_meilisearch_at_launch#search-personalization).
28+
29+
early development and not publicly available.
2430

2531
If you are a Cloud customer and would like to try it out, [get in touch](https://meetings-eu1.hubspot.com/guillaume-mourier/search-personalization)!

learn/resources/experimental_features_overview.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ Activating or deactivating experimental features this way does not require you t
6262
| [Multimodal search](/reference/api/settings) | Enable multimodal search | API route |
6363
| [Disable new indexer](/learn/self_hosted/configure_meilisearch_at_launch) | Use previous settings indexer | CLI flag or environment variable |
6464
| [Experimental vector store](/reference/api/settings) | Enables index setting to use experimental vector store | API route |
65+
| [Search personalization](/learn/personalization/making_personalized_search_queries) | Enables search personalization | CLI flag or environment variable |

learn/self_hosted/configure_meilisearch_at_launch.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,15 @@ Helps running Meilisearch in cluster environments. It does this by modifying tas
552552

553553
Falls back to previous settings indexer.
554554

555+
### Search personalization <NoticeTag type="experimental" label="experimental" />
556+
557+
**Environment variable**: `MEILI_EXPERIMENTAL_PERSONALIZATION_API_KEY`<br />
558+
**CLI option**: `--experimental-personalization-api-key`<br />
559+
**Default value**: `None`<br />
560+
**Expected value**: a Cohere API key
561+
562+
Enables search personalization. Must be a valid Cohere API key in string format.
563+
555564
### S3 options
556565

557566
#### Bucket URL

reference/api/search.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ By default, [this endpoint returns a maximum of 1000 results](/learn/resources/k
9999
| **[`retrieveVectors`](#display-_vectors-in-response)** | Boolean | `false` | Return document and query vector data |
100100
| **[`locales`](#query-locales)** | Array of strings | `null` | Explicitly specify languages used in a query |
101101
| **[`media`](#media)** | Object | `null` | Perform AI-powered search queries with multimodal content |
102+
| **[`personalize`](#search-personalization)** | Object | `null` | Perform AI-powered searches that return different results based on a user's profile |
102103

103104
### Response
104105

@@ -1371,3 +1372,17 @@ It is mandatory to specify an embedder when using `media`. `media` is incompatib
13711372
13721373
}
13731374
```
1375+
1376+
### Search personalization <NoticeTag type="experimental" label="experimental" />
1377+
1378+
**Parameter**: `personalize`<br />
1379+
**Expected value**: Object<br />
1380+
**Default value**: `null`
1381+
1382+
<Note>
1383+
This is an experimental feature. Contact Meilisearch Cloud support to enable it for your projects. If self-hosting, relaunch your instance providing a Cohere key to the search personalization instance option.
1384+
</Note>
1385+
1386+
Adds user context to [personalize search results according to user profile](/learn/personalization/making_personalized_search_queries).
1387+
1388+
`personalize` must be an object. It must include a single field, `userContext`.`userContext` must be a string describing the user performing the search.

0 commit comments

Comments
 (0)