Skip to content

Commit

Permalink
Merge #1550
Browse files Browse the repository at this point in the history
1550: correct misunderstanding of default attribute ranking order r=maryamsulemani97 a=dichotommy

Default attribute ranking `searchableAttributes: ["*"]` is based on the order in which Meilisearch encounters attributes. This was clarified for me by meilisearch/specifications#121, line 316-317.

Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com>
  • Loading branch information
bors[bot] and dichotommy authored May 9, 2022
2 parents 585f403 + dcacc8d commit e095be5
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions learn/core_concepts/relevancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,30 @@ Depending on your needs, you might want to change this order of importance. To d

In a typical dataset, some fields are more relevant to search than others. A `title`, for example, has a value more meaningful to a movie search than its `overview` or its `release_date`.

By default, the attribute ranking order is generated automatically based on the attributes' order of appearance in the indexed documents. However, it can also be set manually.
By default, the attribute ranking order is generated automatically based on the order in which Meilisearch encounters attributes in the indexed documents. In other words, if your first indexed document looks like this:

For a more detailed look at this subject, see our reference page for [the searchable attributes list](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list).
```json
{
"a": "some data",
"b": "more data",
"c": "other data"
}
```

The automatically generated attribute ranking order will be `["a", "b", "c"]`. If you then add a second document that looks like this:

```json
{
"c": "other data",
"d": "surprise data!",
"a": "some data",
"b": "more data"
}
```

The attribute ranking order will be updated to `["a", "b", "c", "d"]`. In other words, when Meilisearch encounters new attributes in subsequently indexed documents, they are added to the bottom of the attribute ranking order.

The attribute ranking order can also be set manually. For a more detailed look at this subject, see our reference page for [the searchable attributes list](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list).

### Example

Expand Down

0 comments on commit e095be5

Please sign in to comment.