Skip to content

Conversation

@ElyarSadig
Copy link
Collaborator

@ElyarSadig ElyarSadig commented Jul 18, 2025

Pull Request

Related issue

Fixes #638

What does this PR do?

  • Add new field disableOnNumbers to typoTolerance settings API
  • Update Index_UpdateSettings setting with new field disableOnNumbers

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features
    • Added support for the DisableOnNumbers option in typo tolerance settings, allowing users to control whether typo tolerance is applied to numbers in search queries.
    • Updated code samples and tests to demonstrate and validate the new DisableOnNumbers setting.

@coderabbitai
Copy link

coderabbitai bot commented Jul 18, 2025

Walkthrough

A new boolean field, DisableOnNumbers, was added to the TypoTolerance struct to support disabling typo tolerance on numbers. Test cases and default initializations were updated to include this field. Additionally, a new code sample demonstrates updating this setting for the "movies" index.

Changes

File(s) Change Summary
types.go Added DisableOnNumbers boolean field to TypoTolerance struct with JSON tag.
index_settings_test.go, main_test.go Updated test data and default values to include DisableOnNumbers in TypoTolerance.
.code-samples.meilisearch.yaml Added code sample typo_tolerance_guide_5 showing usage of disableOnNumbers in settings.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant SDK
    participant Meilisearch

    Client->>SDK: Update typo tolerance with disableOnNumbers
    SDK->>Meilisearch: PATCH /indexes/:index/settings/typo-tolerance { disableOnNumbers: true }
    Meilisearch-->>SDK: Responds with updated settings
    SDK-->>Client: Returns updated TypoTolerance object
Loading

Poem

In fields of search, a number appears,
Now typo tolerance shifts its gears.
With a toggle set to true or false,
The tests all dance, the docs waltz.
A rabbit hops, with settings anew,
Typo tolerance—now numbers askew!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a80a2ad and cba8f27.

📒 Files selected for processing (4)
  • .code-samples.meilisearch.yaml (1 hunks)
  • index_settings_test.go (12 hunks)
  • main_test.go (1 hunks)
  • types.go (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
index_settings_test.go (1)
types.go (2)
  • TypoTolerance (75-81)
  • MinWordSizeForTypos (84-87)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: integration-tests (go latest version)
  • GitHub Check: integration-tests (go current version)
🔇 Additional comments (6)
types.go (1)

80-80: LGTM! Clean addition of the new field.

The DisableOnNumbers field is properly implemented with correct Go naming conventions, appropriate JSON tags, and follows the existing patterns in the struct. The omitempty tag ensures backward compatibility by omitting the field when false.

.code-samples.meilisearch.yaml (1)

526-529: Good documentation example for the new feature.

The code sample clearly demonstrates how to use the new DisableOnNumbers field and follows the established pattern of other typo tolerance examples. This will help users understand how to implement this feature.

main_test.go (1)

30-30: Proper test configuration update.

Adding DisableOnNumbers: false to the default test configuration is necessary to maintain consistency with the updated struct and ensures all tests using this default will have the new field properly initialized.

index_settings_test.go (3)

1703-1703: LGTM! New field properly integrated into test cases.

The DisableOnNumbers field is correctly added to the TypoTolerance struct in both test cases, ensuring the new functionality is properly tested.

Also applies to: 1797-1797


2537-2537: LGTM! Proper testing of field updates.

The test correctly validates that DisableOnNumbers can be updated from false to true and that the changes are properly persisted in the response.

Also applies to: 2557-2557, 2584-2584, 2610-2610


3192-3192: LGTM! Comprehensive testing of DisableOnNumbers field.

The test cases thoroughly cover different scenarios for the DisableOnNumbers field:

  • Setting it to true and false
  • Testing with different combinations of other TypoTolerance fields
  • Verifying the field is properly returned in responses
  • Testing with both basic and custom clients

The assertion logic correctly compares expected vs actual responses.

Also applies to: 3198-3207, 3222-3222, 3228-3237, 3254-3254, 3260-3269, 3286-3286, 3292-3301, 3316-3316, 3324-3330, 3348-3348

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.54%. Comparing base (a80a2ad) to head (cba8f27).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #651   +/-   ##
=======================================
  Coverage   84.54%   84.54%           
=======================================
  Files          17       17           
  Lines        3113     3113           
=======================================
  Hits         2632     2632           
  Misses        346      346           
  Partials      135      135           

☔ 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.

@ja7ad
Copy link
Collaborator

ja7ad commented Jul 18, 2025

Thank you
bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Jul 18, 2025

Build succeeded:

@meili-bors meili-bors bot merged commit 0545f0b into meilisearch:main Jul 18, 2025
7 checks passed
@curquiza curquiza added the enhancement New feature or request label Jul 31, 2025
@curquiza curquiza changed the title feat: add disableOnNumbers to TypoTolerance Add disableOnNumbers to TypoTolerance Jul 31, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 17, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v1.15] Add disableOnNumbers to typo tolerance settings

3 participants