Skip to content

Improve Settings #1864

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Improve Settings #1864

wants to merge 22 commits into from

Conversation

flevi29
Copy link
Collaborator

@flevi29 flevi29 commented Feb 4, 2025

Pull Request

What does this PR do?

  • simplifies, improves, separates and documents Settings types
  • embedder settings types are no longer embedder specific for the sake of simplicity and to match more closely the rust source code types
  • from now on individual setting manipulation methods are generated into the property of setting of the Index class
  • massively refactor tests regarding settings
    • TODO: Explain lack of bad host and permission tests
    • some ebedder tests will be moved to search tests Improve search #1925
  • depends on Add experimental features methods #1928
  • fixes Strange embedder flaky CI error #1923 🤞

Migration

  • client.index(uid).updateSettings now requires the type UpdatableSettings instead of just Settings

Same for all the individual settings, including get and reset methods!

- client.index(uid).updateFaceting(...);
+ client.index(uid).setting.updateFaceting(...);

Same for all the individual settings

- import type { PaginationSettings } from "meilisearch";
+ import type { SingleUpdatableSettings } from "meilisearch";
+ declare const pgSettings: SingleUpdatableSettings["pagination"];

@flevi29 flevi29 added the enhancement New feature or request label Feb 4, 2025
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 95.06173% with 4 lines in your changes missing coverage. Please review.

Project coverage is 97.95%. Comparing base (69e056c) to head (b523bca).

Files with missing lines Patch % Lines
src/meilisearch.ts 69.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1864      +/-   ##
==========================================
- Coverage   99.02%   97.95%   -1.07%     
==========================================
  Files          18       19       +1     
  Lines        1435     1175     -260     
  Branches      303      252      -51     
==========================================
- Hits         1421     1151     -270     
- Misses         14       24      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@flevi29 flevi29 linked an issue Feb 4, 2025 that may be closed by this pull request
8 tasks
@flevi29 flevi29 mentioned this pull request Feb 4, 2025
8 tasks
@flevi29 flevi29 removed a link to an issue Feb 4, 2025
8 tasks
@flevi29 flevi29 requested a review from Copilot April 6, 2025 19:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

@flevi29 flevi29 requested a review from Strift April 6, 2025 19:37
@flevi29 flevi29 added breaking-change The related changes are breaking for the users and removed enhancement New feature or request labels Apr 9, 2025
@flevi29 flevi29 marked this pull request as draft April 9, 2025 09:45
@flevi29 flevi29 marked this pull request as ready for review April 11, 2025 06:58
@flevi29 flevi29 marked this pull request as draft April 17, 2025 13:41
@flevi29 flevi29 changed the title Improve Settings types Improve Settings Apr 22, 2025
@flevi29 flevi29 marked this pull request as ready for review April 25, 2025 07:01
@Strift Strift requested a review from Copilot April 30, 2025 08:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors and improves the handling of Settings by separating and documenting settings types, centralizing settings update methods under a new "setting" property on the Index class, and significantly refactoring the tests related to settings. Key changes include:

  • Moving and redefining Settings types into a dedicated settings module.
  • Updating API calls to use the new client.index(...).setting.* method pattern.
  • Removing or refactoring a number of tests to align with the new settings updates and experimental features support.

Reviewed Changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated no comments.

File Description
tests/*.test.ts Updates to test files to use new settings methods and removal of redundant tests
src/types/*.ts Refactoring of settings types and removal of duplicated definitions
src/settings.ts, src/meilisearch.ts Introduction of new settings functions and experimental features endpoints
README.md, .code-samples.meilisearch.yaml Documentation updates to reflect new settings API usage
Comments suppressed due to low confidence (3)

tests/faceting.test.ts:1

  • Several test files (e.g. faceting, filterable_attributes, facet_search_settings, distinct_attribute, displayed_attributes, dictionary) have been removed. Please ensure that the new or remaining tests fully cover all the settings functionalities previously verified to avoid gaps in test coverage.
Entire file removed

src/meilisearch.ts:459

  • The new getExperimentalFeatures and updateExperimentalFeatures endpoints have been added using the 'patch' method for updates. Verify that these endpoints are fully documented, have clear versioning implications, and that there are adequate tests for their behavior.
New experimental features endpoints added

README.md:262

  • Make sure that all usage examples and code samples in the documentation and YAML files accurately reflect the new settings API changes and provide guidance for users during migration.
Documentation examples updated to use client.index('myIndex').setting.*

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.

Strange embedder flaky CI error
1 participant