MeiliSearch/meilisearch-http/tests
bors[bot] 25ec51e783
Merge #2601
2601: Ease search result pagination r=Kerollmops a=ManyTheFish

# Summary
This PR is a prototype enhancing search results pagination (#2577)

# Todo

- [x] Update the API to return the number of pages and allow users to directly choose a page instead of computing an offset
- [x] Change computation of `total_pages` in order to have an exact count
  - [x] compute query tree exhaustively
  - [x] compute distinct exhaustively

# Small Documentation

## Default search query

**request**:
```sh
curl \
  -X POST 'http://localhost:7700/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "botman" }'
```

**result**:
```json
{
  "hits":[...],
  "query":"botman",
  "processingTimeMs":5,
  "hitsPerPage":20,
  "page":1,
  "totalPages":4,
  "totalHits":66
}
```

## Search query with offset parameter

**request**:
```sh
curl \
  -X POST 'http://localhost:7700/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "botman", "offset": 0 }'
```

**result**:
```json
{
  "hits":[...],
  "query":"botman",
  "processingTimeMs":3,
  "limit":20,
  "offset":0,
  "estimatedTotalHits":66
}
```

## Search query selecting page with page parameter

**request**:
```sh
curl \
  -X POST 'http://localhost:7700/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "botman", "page": 2 }'
```

**result**:
```json
{
  "hits":[...],
  "query":"botman",
  "processingTimeMs":5,
  "hitsPerPage":20,
  "page":2,
  "totalPages":4,
  "totalHits":66
}
```

# Related

fixes #2577

## In charge of the feature

Core: `@ManyTheFish` 
Docs: `@guimachiavelli` 
Integration: `@bidoubiwa` 


Co-authored-by: ManyTheFish <many@meilisearch.com>
2022-10-26 16:10:58 +00:00
..
assets Fix content of dump/assets for testing 2022-06-22 14:51:52 +02:00
auth fix wrong variant returned for invalid_api_key_indexes error 2022-10-18 19:41:06 +05:30
common Fix formatting and shaving lints 2022-10-13 15:49:23 +02:00
dashboard Skip dashboard test if mini-dashboard feature is disabled 2022-09-29 01:42:52 +02:00
documents Fix formatting and shaving lints 2022-10-13 15:49:23 +02:00
dumps Make the changes necessary to use milli 0.31.1 2022-06-23 10:47:49 +02:00
index Fix formatting and shaving lints 2022-10-13 15:49:23 +02:00
search Add some tests 2022-10-20 17:03:07 +02:00
settings Make the changes necessary to use milli 0.31.1 2022-06-23 10:47:49 +02:00
snapshot feat(http): paginate the index resource 2022-05-31 18:11:45 +02:00
stats Rename the uid to taskUid in asynchronous response 2022-05-31 11:33:20 +02:00
tasks chore: test comment readability improvements 2022-06-28 18:09:25 -05:00
content_type.rs clippy & fmt fixed 2022-08-22 13:21:22 +05:30
integration.rs chore(dump): add tests 2022-05-24 14:21:56 +02:00