Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.28: Add pagination to core concepts/indexes #1766

Merged
merged 13 commits into from
Jul 4, 2022
Merged
8 changes: 8 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -958,3 +958,11 @@ getting_started_typo_tolerance: |-
--data-binary '{
"minWordSizeForTypos": { "oneTypo": 4 }
}'
settings_guide_pagination_1: |-
curl \
-X PATCH 'http://localhost:7700/indexes/movies/settings/pagination' \
-H 'Content-Type: application/json' \
--data-binary '{
"maxTotalHits": 50
}'

guimachiavelli marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .vuepress/public/sample-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,4 @@ updating_guide_retrieve_documents_old: |-
updating_guide_update_settings_old: |-
updating_guide_add_documents_old: |-
getting_started_typo_tolerance: |-
settings_guide_pagination_1: |-
Empty file added learn/advanced/pagination.md
Empty file.
17 changes: 17 additions & 0 deletions learn/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This page describes the **index-level settings** available in Meilisearch and ho
| **[displayedAttributes](/learn/configuration/settings.md#displayed-attributes)** | Fields displayed in the returned documents | All attributes found in the documents |
| **[distinctAttribute](/learn/configuration/settings.md#distinct-attribute)** | Search returns documents with distinct (different) values of the given field | `null` |
| **[filterableAttributes](/learn/configuration/settings.md#filterable-attributes)** | List of attributes that can be used for filtering | `null` |
| **[pagination](/learn/advanced/pagination.md)** | Pagination settings | `{}`
| **[rankingRules](/learn/configuration/settings.md#ranking-rules)** | List of ranking rules sorted by order of importance | [A list of ordered built-in ranking rules](/learn/core_concepts/relevancy.md#built-in-rules) |
| **[searchableAttributes](/learn/configuration/settings.md#searchable-attributes)** | Fields in which to search for matching query words sorted by order of importance | All attributes found in the documents | |
| **[sortableAttributes](/learn/configuration/settings.md#sortable-attributes)** | List of attributes to use when sorting search results | `[]` |
Expand Down Expand Up @@ -95,6 +96,22 @@ To be able to filter search results on `director` and `genres` in a movie databa

<CodeSamples id="faceted_search_update_settings_1" />

## Pagination

The maximum number of results Meilisearch can return. By default, this value is `1000` which means you cannot access results beyond `1000`.

[Learn more about pagination in our dedicated guide.](/learn/advanced/pagination.md)

### Example

The code sample below updates `maxTotalHits` to `50`:

<CodeSamples id="settings_guide_pagination_1" />

::: note
`maxTotalHits` takes priority over search parameters such as [`limit`](/reference/api/search.md#limit) and [`offset`](/reference/api/search.md#offset).
:::

## Ranking rules

Built-in ranking rules that **ensure relevancy in search results**. Ranking rules are applied in a default order which can be changed in the settings. You can add or remove rules and change their order of importance.
Expand Down
7 changes: 7 additions & 0 deletions learn/core_concepts/indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ You can customize the following index settings:
- [Stop words](#stop-words)
- [Displayed and searchable attributes](#displayed-and-searchable-attributes)
- [Typo tolerance](#typo-tolerance)
- [Pagination](#pagination)

To change index settings, use the [update settings endpoint](/reference/api/settings.md#update-settings) or any of the [child routes](/reference/api/settings.md#all-settings).

Expand Down Expand Up @@ -130,3 +131,9 @@ Typo tolerance is a built-in feature that helps you find relevant results even w
You can update the typo tolerance settings using the [update settings endpoint](/reference/api/settings.md#update-settings) or the [update typo tolerance endpoint](/reference/api/typo_tolerance.md#update-typo-tolerance).

[Learn more about typo tolerance](/learn/configuration/typo_tolerance.md)

### Pagination

To protect your database from malicious scraping, Meilisearch only returns up to `1000` results for a search query. You can change this limit using the [update settings endpoint](/reference/api/settings.md#update-settings) or the [update pagination settings endpoint](/reference/api/pagination.md#update-pagination-settings).

[Learn more about pagination](/learn/advanced/pagination.md)