Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Release v1.2.0 #227

Merged
merged 9 commits into from
Jun 5, 2023
137 changes: 135 additions & 2 deletions open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.1.0
info:
title: Meilisearch Core API
description: 'Search documents, configure and manage the Meilisearch engine.'
version: 1.1.0
version: 1.2.0
contact:
name: Meilisearch
email: [email protected]
Expand Down Expand Up @@ -1208,7 +1208,7 @@ components:
examples:
Payload Too Large:
value:
message: The provided payload reached the size limit.
message: The provided payload reached the size limit. The maximum accepted payload size is 20.00 MiB.
code: payload_too_large
type: invalid_request
link: 'https://docs.meilisearch.com/errors#payload_too_large'
Expand Down Expand Up @@ -1664,6 +1664,7 @@ paths:
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/fields'
- $ref: '#/components/parameters/filter'
post:
operationId: indexes.documents.create
summary: Add or replace documents
Expand Down Expand Up @@ -1805,6 +1806,93 @@ paths:
description: Not Found
parameters:
- $ref: '#/components/parameters/indexUid'
'/indexes/{indexUid}/documents/fetch':
post:
operationId: indexes.documents.fetch
summary: Get Documents
description: |
Get [documents](https://docs.meilisearch.com/learn/core_concepts/documents.html) by batch.
tags:
- Documents
security:
- apiKey: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
offset:
type: number
description: Number of documents to skip.
default: 0
limit:
type: number
description: Maximum number of documents returned.
default: 20
fields:
type: array
description: 'Array of attributes whose fields will be present in the returned documents. By default all attributes will be returned.'
items:
type: string
example: '["title", "overview"]'
default: '["*"]'
filter:
$ref: '#/components/schemas/filter'
examples:
Example:
value:
offset: 2
limit: 5
fields:
- name
- picture
filter: 'doggo = "bernese mountain"'
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
results:
type: array
items:
$ref: '#/components/schemas/document'
limit:
$ref: '#/components/schemas/limit'
offset:
$ref: '#/components/schemas/offset'
total:
$ref: '#/components/schemas/total'
required:
- results
- limit
- offset
- total
examples:
Example:
value:
results:
- id: 25684
title: American Ninja 5
poster: 'https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg'
overview: 'When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.'
release_date: 725846400
- id: 45881
title: The Bridge of San Luis Rey
poster: 'https://image.tmdb.org/t/p/w500/4X7quIcdkc24Cveg5XdpfRqxtYA.jpg'
overview: "The Bridge of San Luis Rey is American author Thornton Wilder's second novel, first published in 1927 to worldwide acclaim. It tells the story of several interrelated people who die in the collapse of an Inca rope-fiber suspension bridge in Peru, and the events that lead up to their being on the bridge.[ A friar who has witnessed the tragic accident then goes about inquiring into the lives of the victims, seeking some sort of cosmic answer to the question of why each had to die. The novel won the Pulitzer Prize in 1928."
release_date: 1072915200
limit: 20
offset: 0
total: 2
'401':
$ref: '#/components/responses/401'
'404':
description: Not Found
'/indexes/{indexUid}/documents/delete-batch':
post:
operationId: indexes.documents.removeBatch
Expand Down Expand Up @@ -1850,6 +1938,51 @@ paths:
- $ref: '#/components/parameters/Content-Type'
parameters:
- $ref: '#/components/parameters/indexUid'
'/indexes/{indexUid}/documents/delete':
post:
operationId: indexes.documents.remove
summary: Delete documents
description: Delete a selection of documents based on a filter.
tags:
- Documents
security:
- apiKey: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
filter:
$ref: '#/components/schemas/filter'
examples:
Example:
value:
offset: 2
limit: 5
fields:
- name
- picture
filter: 'doggo = "bernese mountain"'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/responses/202'
examples:
'202':
$ref: '#/components/examples/202_documentDeletion'
'401':
$ref: '#/components/responses/401'
'404':
description: Not Found
parameters:
- $ref: '#/components/parameters/Content-Type'
parameters:
- $ref: '#/components/parameters/indexUid'
'/indexes/{indexUid}/documents/{documentId}':
get:
operationId: indexes.documents.get
Expand Down
15 changes: 9 additions & 6 deletions text/0028-indexing-csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ While there's [RFC 4180](https://tools.ietf.org/html/rfc4180) as a try to add a

- CSV data format needs to contain a first line representing the list of attributes with the optionally chosen type separated from the attribute name by `:` character. The type is case insensitive.

> An attribute can be specificed with two types: `string` or `number`. A missing type will be interpreted as a `string` by default.
> An attribute can be specificed with three types: `string`, `boolean` or `number`. A missing type will be interpreted as a `string` by default.
>
> Valid headline example: "id:number","title:string","author","price:number"
> Valid headline example: "id:number","title:string","author","price:number","cute:boolean"

- The following CSV lines will represent a document for Meilisearch.
- A `,` character must separate each cell.
Expand All @@ -57,14 +57,15 @@ While there's [RFC 4180](https://tools.ietf.org/html/rfc4180) as a try to add a
##### `null` value

- If a field is of type `string`, then an empty cell is considered as a `null` value (e.g. `,,`), anything else is turned into a string value (e.g. `, ,` is a single whitespace string)
- If a field is of type `number`, when the trimmed field is empty, it's considered as a `null` value (e.g. `,,` `, ,`); otherwise Meilisearch try to parse the number.
- If a field is of type `number`, when the trimmed field is empty, it's considered as a `null` value (e.g. `,,` `, ,`); otherwise, Meilisearch tries to parse the number.
- If a field is of type `boolean`, when the trimmed field is empty, it's considered as a `null` value (e.g. `,,` `, ,`); otherwise, Meilisearch tries to parse the boolean as either `true` or `false`.

##### Example with a comma inside a cell

Given the CSV payload
```
"id:number","label","price:number","colors","description"
"1","t-shirt","4.99","red","Thus, you will rock at summer time."
"id:number","label","price:number","colors","description","contains_a_dog_picture:boolean"
"1","t-shirt","4.99","red","Thus, you will rock at summer time.","false"
```
the search result should be displayed as
```json
Expand All @@ -75,7 +76,8 @@ the search result should be displayed as
"label": "t-shirt",
"price": 4.99,
"colors": "red",
"description": "Hey, you will rock at summer time."
"description": "Thus, you will rock at summer time.",
"contains_a_dog_picture": false
}
],
...
Expand Down Expand Up @@ -172,6 +174,7 @@ curl \
- 🔴 Sending an invalid CSV format will lead to a 400 bad_request - **malformed_payload** error code.
- 🔴 Sending a CSV header that does not conform to the specification will lead to a 400 bad_request - **malformed_payload** error code.
- 🔴 Sending an invalid csv delimiter: not exactly one ASCII char. This will lead to a 400 bad_request - **invalid_document_csv_delimiter** error code.
- 🔴 Sending a CSV cell with the type `number` or `boolean` that can't be parsed will lead to a 400 bad_request - **malformed_payload** error code.

##### Errors Definition

Expand Down
Loading