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 new index settings to configure prefixSearch and facetSearch #1790

Merged
merged 12 commits into from
Dec 10, 2024

Conversation

Strift
Copy link
Collaborator

@Strift Strift commented Dec 3, 2024

Pull Request

Related issue

Fixes #1770

What does this PR do?

  • Update Settings type so the methods getSettings(), and updateSettings can accept the new settings fields: facetSearch & prefixSearch
  • Add the methods for facet search settings: getFacetSearch(), updateFacetSearch(), and resetFacetSearch()
  • Add the new methods for prefix search settings: getPrefixSearch(), updatePrefixSearch(), and resetPrefixSearch() calling the appropriate Meilisearch routes
  • Add the necessary tests (I took example on the tests for displayed attributes settings)
  • Update the README

@Strift Strift marked this pull request as draft December 3, 2024 03:11
@Strift Strift marked this pull request as ready for review December 3, 2024 04:09
@Strift Strift requested a review from mdubus December 3, 2024 04:09
@Strift Strift changed the base branch from main to bump-meilisearch-v0.12.0 December 3, 2024 04:11
@Strift Strift removed the request for review from mdubus December 3, 2024 04:19
@Strift Strift marked this pull request as draft December 3, 2024 04:19
@Strift Strift force-pushed the feat/add-1.12-new-settings branch from 5e69ba6 to 3c2a2b8 Compare December 4, 2024 04:20
@Strift Strift marked this pull request as ready for review December 4, 2024 04:33
@Strift Strift requested a review from mdubus December 4, 2024 04:33
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.

You probably want to update the Readme to add those new settings as well 👍

src/types/types.ts Outdated Show resolved Hide resolved
tests/facet_search_settings.test.ts Show resolved Hide resolved
tests/prefix_search_settings.test.ts Show resolved Hide resolved
Copy link
Collaborator Author

@Strift Strift left a comment

Choose a reason for hiding this comment

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

Thanks for your review! I looked into your comments and answered your feedback.

@Strift Strift requested a review from mdubus December 5, 2024 08:41
@Strift Strift marked this pull request as draft December 5, 2024 08:41
@Strift Strift removed the request for review from mdubus December 5, 2024 08:42
@Strift
Copy link
Collaborator Author

Strift commented Dec 5, 2024

Updated the README as well. I think this is good now 🤞

@Strift Strift marked this pull request as ready for review December 5, 2024 09:07
@Strift Strift requested a review from mdubus December 5, 2024 09:07
@mdubus
Copy link
Member

mdubus commented Dec 5, 2024

Updated the README as well. I think this is good now 🤞

Can you update it to add the prefixSearch too? 🙏

@Strift
Copy link
Collaborator Author

Strift commented Dec 6, 2024

I did, sorry for the inattention mistake 😅

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 2f87b7b into bump-meilisearch-v0.12.0 Dec 10, 2024
6 checks passed
@Strift Strift deleted the feat/add-1.12-new-settings branch December 10, 2024 04:19
@Strift Strift changed the title Add new prefixSearch and facetSearch index settings Add new index settings to configure prefixSearch and facetSearch 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 settings: facetSearch & prefixSearch
2 participants