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

Add methods to get batches #1775

Merged
merged 44 commits into from
Dec 10, 2024
Merged

Conversation

Strift
Copy link
Collaborator

@Strift Strift commented Nov 28, 2024

Pull Request

Related issue

Fixes #1771

What does this PR do?

  • Update the snapshots to v1.12.0-rc1 API responses
  • Create a BatchesClient that implements getBatch() and getBatches() methods
  • Add relevant tests

@Strift Strift marked this pull request as draft November 28, 2024 08:50
Copy link
Member

@irevoire irevoire left a comment

Choose a reason for hiding this comment

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

Hey, you had a small bug on the GET /batches/:uid and the other bug was on meilisearch side, it's fixed and will be merged soon!
See meilisearch/meilisearch#5107

src/batch.ts Outdated Show resolved Hide resolved
tests/batch.test.ts Outdated Show resolved Hide resolved
meili-bors bot added a commit to meilisearch/meilisearch that referenced this pull request Dec 2, 2024
5107: While spamming the batches route we could see a processing batch becoming missing and then finished, this commit ensures the batches goes from processing to finished directly r=irevoire a=irevoire

# Pull Request

## Related issue
Fixes the failed tests from this PR: meilisearch/meilisearch-js#1775
See [this message](https://meilisearch.slack.com/archives/CD7Q2UKGB/p1732784680450749) [private link] for more context

## What does this PR do?
- Ensure we never enter a state where a processing batches (only existing in RAM) becomes « Not found » by removing the processing batches AFTER writing them to disk
- This should also theoretically avoid an issue where a task could go from processing to enqueued and then finished


Co-authored-by: Tamo <[email protected]>
Strift and others added 13 commits December 4, 2024 04:47
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.3 to 3.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@3.3.3...3.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.13.0 to 9.16.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.16.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [globals](https://github.com/sindresorhus/globals) from 15.11.0 to 15.12.0.
- [Release notes](https://github.com/sindresorhus/globals/releases)
- [Commits](sindresorhus/globals@v15.11.0...v15.12.0)

---
updated-dependencies:
- dependency-name: globals
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [eslint](https://github.com/eslint/eslint) from 9.13.0 to 9.16.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v9.13.0...v9.16.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.26.10 to 0.27.2.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](TypeStrong/typedoc@v0.26.10...v0.27.2)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.8.6 to 22.10.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Strift added 11 commits December 4, 2024 11:52
* make 'genre' an array of genres

* Fix tests after making genre an array

* Fix search (post) tests after making genre an array

* Fix typed search tests after updating genre to an array

* Add indices in match positions

* prettier

* Move test before test deleting the index
@Strift Strift dismissed irevoire’s stale review December 4, 2024 04:13

Changes applied

@Strift Strift marked this pull request as ready for review December 4, 2024 04:17
@Strift Strift requested a review from mdubus December 4, 2024 04:18
src/batch.ts Outdated Show resolved Hide resolved
src/batch.ts Outdated Show resolved Hide resolved
src/types/types.ts Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@Strift Strift linked an issue Dec 5, 2024 that may be closed by this pull request
4 tasks
@Strift Strift requested a review from mdubus December 6, 2024 07:54
Copy link
Member

@mdubus mdubus left a comment

Choose a reason for hiding this comment

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

LGTM ✨🦕 🌻

@Strift Strift merged commit 3994181 into bump-meilisearch-v0.12.0 Dec 10, 2024
6 checks passed
@Strift Strift deleted the feat/add-batch-routes branch December 10, 2024 04:19
@Strift Strift changed the title Add batch routes Add methods to get batches Dec 11, 2024
meili-bors bot added a commit that referenced this pull request Dec 23, 2024
1797: Update version for the next release (v0.47.0) r=curquiza a=meili-bot

_This PR is auto-generated._

The automated script updates the version of meilisearch-js to a new version: "v0.47.0"

CHANGELOGS 👇

This version introduces features released on Meilisearch v1.12.0 🎉

Check out the [Meilisearch v1.12.0 changelog](https://github.com/meilisearch/meilisearch/releases/tag/v1.12.0) for more information.

## 🚀 Enhancements

- **Addition:** #1775 

Introducing new methods to get one or several batches, respectively `getBatch()` and `getBatches()`.

```ts
// fetch one batch using batch UID
const batch = await client.getBatch(123)

// fetch all batches
const batches = await client.getBatches()
```

- **Addition:** #1774 

The `getTasks()` methods now accept a `reverse` parameter to retrieve tasks in reverse chronological order.

```ts
const tasks = await client.getTasks({ reverse: true });
```

- **Addition:** #1790

Index settings now allow disabling **prefix search** and **facet search**. They're both enabled by default. The SDK now comes with dedicated methods to configure these settings.

```ts
// disable prefix search
await client.index('myIndex').updatePrefixSearch('disabled')
// reset prefix search settings
await client.index('myIndex').resetPrefixSearch()

// disable facet search
await client.index('myIndex').updateFacetSearch(false)
// reset facet search settings
await client.index('myIndex').resetFacetSearch()
```

- **Update:** #1773 

The `_matchesPosition` array now contains an `indices` array the text was matched in an array.

When searching for `fantasy` in a document that has a searchable `genre` field with the value `genre: ["fantasy", "adventure"]`, the matches position will be as follow: 

```ts
{
  genre: [{ start: 0, length: 7, indices: [0] }]
}
```

Which means:
- There was a single match in the `genre` array (array length == 1)
- The match started as position `0` (the first character, "f")
- The match has a length of `7` (the entire "fantasy" word)
- The match was in the first item of the array (indices == [0]) 

⚙️ Maintenance/misc

- Update CONTRIBUTING.md with minimal Node version (#1788) 

Thanks again to `@/irevoire,` `@/Barabasbalazs,` `@/irevoire,` `@/curquiza,` and `@/Strift.` 🎉

Co-authored-by: meili-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v1.12.0] New batch routes
6 participants