-
Notifications
You must be signed in to change notification settings - Fork 90
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
NDJSON/CSV methods to add and update documents #1061
Comments
@curquiza Can I work on this? |
Thanks for your interest in this project :) FYI, we prefer not assigning people to our issues because sometimes people ask to be assigned and never come back, which discourages the volunteer contributors to open a PR to fix this issue. We are looking forward to reviewing your PR 🙂 |
1474: Add method to add/update documents from a string r=bidoubiwa a=bidoubiwa Partial: #1061 Introduces two methods on Index(): - `addDocumentsFromString` - `updateDocumentsFromString` These allow the user to add documents using any of the following format: `csv`, `json` or `jsonld`. They require 2 parameters and 1 optional parameter: - the documents in a string - the content type, either one of the following options: - `'text/csv'` or `ContentType.CSV` in typescript - `'application/x-ndjson'` or `ContentType.NDJSON` in typescript - 'application/json' or `ContentType.JSON` in typescript - The document addition options. for example the primary key The content of the string must match its content-type. Only when using the `CSV` format it is possible to use `csvDelimiter` Usage: ```ts client.index('myIndex').addDocumentsFromString(documents: string, contentType: ContentType, queryParams: RawDocumentAdditionOptions): Promise<EnqueuedTask> ``` ```ts client.index('myIndex').updateDocumentsFromString(documents: string, contentType: ContentType, queryParams: RawDocumentAdditionOptions): Promise<EnqueuedTask> ``` ### Example: https://github.com/meilisearch/meilisearch-js/blob/d948a7551108b18def7e1e69c05997c47b9ac2ae/tests/raw_document.test.ts#L164-L174 Co-authored-by: Charlotte Vermandel <[email protected]>
Partially fixed by: #1474 |
add_documents_json
instead ofaddDocumentsJson
). Keep the already existing way of naming in this package to stay idiomatic with the language and this repository.📣 We strongly recommend doing multiple PRs to solve all the points of this issue
MeiliSearch v0.23.0 introduces two changes:
Content-type
header for every route requiring a payload (POST
andPUT
routes)Here are the expected changes to completely close the issue:
Content-Type: application/json
to every request. Only thePOST
andPUT
requests should send theContent-Type: application/json
and not theDELETE
andGET
ones.csv
orndjson
) the SDK should sendContent-Type: application/x-dnjson
orContent-Type: text/csv
)addDocumentsJson(string docs, string primaryKey)
addDocumentsCsv(string docs, string primaryKey, string csvDelimiter)
addDocumentsCsvInBatches(string docs, int batchSize, string primaryKey, string csvDelimiter)
addDocumentsNdjson(string docs, string primaryKey)
addDocumentsNdjsonInBatches(string docs, int batchSize, string primaryKey)
csv
orndjson
) the SDK should sendContent-Type: application/x-dnjson
orContent-Type: text/csv
)updateDocumentsJson(string docs, string primaryKey)
updateDocumentsCsv(string docs, string primaryKey, string csvDelimiter)
updateDocumentsCsvInBatches(string docs, int batchSize, string primaryKey, string csvDelimiter)
updateDocumentsNdjson(string docs, string primaryKey)
updateDocumentsNdjsonInBatches(string docs, int batchSize, string primaryKey)
docs
are the documents sent asString
primaryKey
is the primary key of the indexbatchSize
is the size of the batch. Example: you can send 2000 documents in raw String indocs
and ask for abatchSize
of 1000, so your documents will be sent to MeiliSearch in two batches.Example of PRs:
CSV
NDJSON
meilisearch-python#329Related to: meilisearch/integration-guides#146
If this issue is partially/completely implemented, feel free to let us know.
The text was updated successfully, but these errors were encountered: