meilisearch-rust
meilisearch-rust copied to clipboard
Add support for typo tolerance customization
Pull Request
Related issue
Fixes #260
What does this PR do?
- ...
PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?
Thank you so much for contributing to Meilisearch!
I know it was not part of the PR description, but could you add (or update) the following code-samples based on this example:
- get_typo_tolerance_1
- update_typo_tolerance_1
- reset_typo_tolerance_1
- typo_tolerance_guide_1
- typo_tolerance_guide_2
- typo_tolerance_guide_3
- typo_tolerance_guide_4
- settings_guide_typo_tolerance_1
- getting_started_typo_tolerance
- update_settings_1
I know it was not part of the PR description, but could you add (or update) the following code-samples based on this example:
* get_typo_tolerance_1 * update_typo_tolerance_1 * reset_typo_tolerance_1 * typo_tolerance_guide_1 * typo_tolerance_guide_2 * typo_tolerance_guide_3 * typo_tolerance_guide_4 * settings_guide_typo_tolerance_1 * getting_started_typo_tolerance * update_settings_1
ok. I will add these.
Hey @vishalsodani thanks for this contribution :)
Could you look at the specification? I think the parameters are optional
Can you please review? I have made the parameters optional. Is the implementation ok?
one_type and two_typos are u8 and not i64. See here
Hi,
I feel there is an issue with this API design. If I tun this test, the test fails
`
#[meilisearch_test]
async fn test_set_typo_tolerance(client: Client, index: Index) {
let typo_tolerance = TypoToleranceSettings {
enabled: None,
disable_on_attributes: Some(vec![]),
disable_on_words: Some(vec![]),
min_word_size_for_typos: Some(MinWordSizeForTypos {
one_typo: Some(6),
two_typos: Some(9),
}),
};
let task_info = index.set_typo_tolerance(&typo_tolerance).await.unwrap();
client.wait_for_task(task_info, None, None).await.unwrap();
let res = index.get_typo_tolerance().await.unwrap();
assert_eq!(typo_tolerance, res);
}
left: `TypoToleranceSettings { enabled: None, disable_on_attributes: Some([]), disable_on_words: Some([]), min_word_size_for_typos: Some(MinWordSizeForTypos { one_typo: Some(6), two_typos: Some(9) }) }`,
right: `TypoToleranceSettings { enabled: Some(true), disable_on_attributes: Some([]), disable_on_words: Some([]), min_word_size_for_typos: Some(MinWordSizeForTypos { one_typo: Some(6), two_typos: Some(9) }) }`', src/settings.rs:1609:9
We are setting enabled as None which should not be allowed. Am I correct?
I know it was not part of the PR description, but could you add (or update) the following code-samples based on this example:
* get_typo_tolerance_1 * update_typo_tolerance_1 * reset_typo_tolerance_1 * typo_tolerance_guide_1 * typo_tolerance_guide_2 * typo_tolerance_guide_3 * typo_tolerance_guide_4 * settings_guide_typo_tolerance_1 * getting_started_typo_tolerance * update_settings_1
Added.
Hey @vishalsodani thanks for this contribution :)
Could you look at the specification? I think the parameters are optional
I have redesigned the API to use a builder pattern. So, a user is able to create a default object and can then set various attributes.
@bidoubiwa Hi, I am done with all the changes. Please review. Thanks!
- default_one_typo_size
ok. Should I also revert the builder pattern? It does not seem that useful now.
Hey @vishalsodani
Actually, you are right and just raised a bug in Meilisearch haha! See this spec
Great!
Should I also revert the builder pattern? It does not seem that useful now.
Yes probably it is best to keep consistency with the other nested settings like pagination that are not using the builder pattern.
@bidoubiwa
Can you remove: Done
This message is sent automatically
Thanks again for contributing to Meilisearch :heart: If you are participating in Hacktoberfest, and you would like to receive some gift from Meilisearch too, please complete this form.
Hey @vishalsodani
I'm a bit underwater right now. I gave you the hacktoberfest-accepted label in order to validate your PR for DO.
What's the state of this PR? I can also help to improve it if there is something missing?
We need this.
@irevoire, the original author hasn't had any activity on GitHub since then. Seems like somebody else needs to take control.
It's been merged via the following PR: https://github.com/meilisearch/meilisearch-rust/pull/480 @bidoubiwa let's close this also 🙏🏼
Absolutely :)