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

Configure Csv delimiter #424

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Configure Csv delimiter #424

merged 1 commit into from
Mar 28, 2023

Conversation

alallema
Copy link
Contributor

@alallema alallema commented Mar 27, 2023

Add the ability to provide a CSV delimiter for adding and updating CSV documents as in the specification

SDK requirements: meilisearch/integration-guides#251

All these methods taking CSV have changed
Changes:

  • New type CsvDocumentsQuery{}
  • AddDocumentsCsv(documents []byte, primaryKey ...string) (resp *TaskInfo, err error)
    -> AddDocumentsCsv(documents []byte, options *CsvDocumentsQuery) (resp *TaskInfo, err error)
  • AddDocumentsCsvInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []TaskInfo, err error)
    -> AddDocumentsCsvInBatches(documents []byte, batchSize int, options *CsvDocumentsQuery) (resp []TaskInfo, err error)
  • UpdateDocumentsCsv(documents []byte, primaryKey ...string) (resp *TaskInfo, err error)
    -> UpdateDocumentsCsv(documents []byte, options *CsvDocumentsQuery) (resp *TaskInfo, err error)
  • UpdateDocumentsCsvInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []TaskInfo, err error)
    -> UpdateDocumentsCsvInBatches(documents []byte, batchSize int, options *CsvDocumentsQuery) (resp []TaskInfo, err error)

@alallema alallema requested a review from bidoubiwa March 27, 2023 14:57
@bidoubiwa
Copy link
Contributor

Linter tests are failing

if err != nil {
return nil, err
}
return resp, nil
}

func (i Index) saveDocumentsFromReaderInBatches(documents io.Reader, batchSize int, documentsCsvFunc func(recs []byte, pk ...string) (resp *TaskInfo, err error), primaryKey ...string) (resp []TaskInfo, err error) {
func (i Index) saveDocumentsFromReaderInBatches(documents io.Reader, batchSize int, documentsCsvFunc func(recs []byte, op *CsvDocumentsQuery) (resp *TaskInfo, err error), options *CsvDocumentsQuery) (resp []TaskInfo, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method only used for CSV?

Copy link
Contributor Author

@alallema alallema Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that why there is documentsCsvFunc in the parameters too

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! It was not very clear per the function name

@alallema alallema requested a review from bidoubiwa March 28, 2023 11:37
Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥🔥🔥🔥

@alallema alallema merged commit 93eea17 into bump-meilisearch-v1.1.0 Mar 28, 2023
@alallema alallema deleted the csv-delimiter branch March 28, 2023 12:06
@alallema alallema added the breaking-change The related changes are breaking for the users label Mar 29, 2023
bors bot added a commit that referenced this pull request Apr 3, 2023
427: Update version for the next release (v0.24.0) r=bidoubiwa a=meili-bot

This version makes this package compatible with Meilisearch v1.1 🎉
Check out the changelog of [Meilisearch v1.1](https://github.com/meilisearch/meilisearch/releases/tag/v1.1.0) for more information on the changes.

## 🐛 Bug Fixes

- Fills the client field for each index entry returned by GetIndexes (#426) `@candiduslynx`

## ⚠️ Breaking changes

- Add the ability to provide a specific `csv-delimiter` when adding and updating documents in CSV format (#424) `@alallema`
    - New type `CsvDocumentsQuery{}`
    -  Changed `AddDocumentsCsv()` which takes `CsvDocumentsQuery` as a parameter instead of a `...string`
    -  Changed `AddDocumentsCsvInBatches()` which takes  `CsvDocumentsQuery` as a parameter instead of a `...string`
    -  Changed `UpdateDocumentsCsv()` which takes  `CsvDocumentsQuery` as a parameter instead of a `...string`
    -  Changed `UpdateDocumentsCsvInBatches()` which takes  `CsvDocumentsQuery` as a parameter instead of a `...string`

## 🚀 Enhancements

- Add FacetStats field in SearchResponse (#423) `@alallema`
- New method `client.MultiSearch()` provides the possibility to make multiple requests at once (#422) `@alallema`

Example:
```go
  client.MultiSearch(&MultiSearchRequest{
    Queries: []SearchRequest{
      {
        IndexUID: "movies",
        Query:    "pooh",
        Limit:    5,
      },
      {
        IndexUID: "movies",
        Query:    "nemo",
        Limit:    5,
      },
      {
        IndexUID: "movie_ratings",
        Query:    "us",
      },
    },
  })
```

Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
bors bot added a commit that referenced this pull request Apr 3, 2023
418: Changes related to the next Meilisearch release (v1.1.0) r=bidoubiwa a=meili-bot

Related to this issue: meilisearch/integration-guides#251

This PR:
- gathers the changes related to the next Meilisearch release (v1.1.0) so that this package is ready when the official release is out.
- should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases).
- might eventually contain test failures until the Meilisearch v1.1.0 is out.

⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.1.0) is out.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._

Done:
- #422 
- #423
- #424

Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Co-authored-by: alallema <amelie@meilisearch.com>
Co-authored-by: Amélie <alallema@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants