-
Notifications
You must be signed in to change notification settings - Fork 133
Add disableOnNumbers setting in TypoTolerance #885
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 disableOnNumbers setting in TypoTolerance #885
Conversation
WalkthroughAdds a new TypoTolerance field Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant SDK as SDK Client
participant Model as TypoTolerance (SDK)
participant Server as Meilisearch Server
SDK->>Model: construct TypoTolerance { disableOnNumbers: true }
SDK->>Server: updateTypoTolerance(index="movies", TypoTolerance)
Server-->>SDK: 200 OK (settings queued/updated)
SDK->>Server: getTypoTolerance(index="movies")
Server-->>SDK: TypoTolerance { disableOnNumbers: true }
note right of Server #DDEBF7: New field persisted and returned by server
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.code-samples.meilisearch.yaml (1)
455-458: Docs sample looks good; minor consistency nit on index naming.Most samples use "movies"/"books". If "1917" isn’t intentional to emphasize numeric terms, prefer staying consistent with other examples.
Apply this minimal change if consistency is preferred:
- client.index("1917").updateTypoToleranceSettings(typoTolerance); + client.index("movies").updateTypoToleranceSettings(typoTolerance);src/test/java/com/meilisearch/integration/SettingsTest.java (1)
903-919: Good coverage for disableOnNumbers; consider also asserting the toggle back to false.The test validates default false and setting true. Adding a final toggle back to false ensures both directions of the update work.
Apply this diff to extend the test:
TypoTolerance updatedTypoToleranceDisableOnNumbers = index.getTypoToleranceSettings(); assertThat(updatedTypoToleranceDefault.isDisableOnNumbers(), is(equalTo(false))); assertThat(updatedTypoToleranceDisableOnNumbers.isDisableOnNumbers(), is(equalTo(true))); + + // Toggle back to false and assert + TypoTolerance newTypoToleranceBackToFalse = new TypoTolerance().setDisableOnNumbers(false); + index.waitForTask(index.updateTypoToleranceSettings(newTypoToleranceBackToFalse).getTaskUid()); + TypoTolerance updatedTypoToleranceBackToFalse = index.getTypoToleranceSettings(); + assertThat(updatedTypoToleranceBackToFalse.isDisableOnNumbers(), is(equalTo(false)));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.code-samples.meilisearch.yaml(1 hunks)src/main/java/com/meilisearch/sdk/model/TypoTolerance.java(1 hunks)src/test/java/com/meilisearch/integration/SettingsTest.java(1 hunks)
8e62e9b to
56987a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/java/com/meilisearch/integration/SettingsTest.java (1)
903-919: Drop the no-op update; fetch baseline directly to reduce runtime and ambiguity.Updating with an empty TypoTolerance ({}) is unnecessary for a fresh index and can be misleading. Read the baseline first, then toggle to true.
@@ - TypoTolerance newTypoTolerance = new TypoTolerance(); - index.waitForTask(index.updateTypoToleranceSettings(newTypoTolerance).getTaskUid()); - TypoTolerance updatedTypoToleranceDefault = index.getTypoToleranceSettings(); + TypoTolerance updatedTypoToleranceDefault = index.getTypoToleranceSettings();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/meilisearch/sdk/model/TypoTolerance.java(1 hunks)src/test/java/com/meilisearch/integration/SettingsTest.java(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/meilisearch/sdk/model/TypoTolerance.java
|
Could you check it please? :) |
Strift
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @joonseolee and thanks for your contribution 🙌
.code-samples.meilisearch.yaml
Outdated
| typo_tolerance_guide_5: |- | ||
| TypoTolerance typoTolerance = new TypoTolerance(); | ||
| typoTolerance.setDisableOnNumbers(true); | ||
| client.index("1917").updateTypoToleranceSettings(typoTolerance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| client.index("1917").updateTypoToleranceSettings(typoTolerance); | |
| client.index("movies").updateTypoToleranceSettings(typoTolerance); |
| TypoTolerance newTypoTolerance = new TypoTolerance(); | ||
| index.waitForTask(index.updateTypoToleranceSettings(newTypoTolerance).getTaskUid()); | ||
| TypoTolerance updatedTypoToleranceDefault = index.getTypoToleranceSettings(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify by simply fetching the initial typo tolerance settings, e.g. simply
Index index = createIndex("testUpdateDisableOnNumbers");
TypoTolerance defaultTypoTolerance = index.getTypoToleranceSettings();Initializing an empty index with default settings can be confusing
| assertThat(updatedTypoToleranceDefault.getDisableOnNumbers(), is(equalTo(false))); | ||
| assertThat(updatedTypoToleranceDisableOnNumbers.getDisableOnNumbers(), is(equalTo(true))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After simplifying above, we can make this a bit clearer with two assertions
- one on the
defaultTypoTolerance - one on the
updatedTypoTolerance
56987a3 to
8a976a4
Compare
|
I’ve made the changes you mentioned and updated them. |
Strift
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Let's get this merged 🙌
Pull Request
Related issue
Fixes #871
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit
New Features
Documentation
Tests