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 typo tolerance settings #294

Merged
merged 2 commits into from
May 4, 2022
Merged

Conversation

alallema
Copy link
Contributor

@alallema alallema commented Apr 28, 2022

This PR introduces the new setting: typoTolerance

new methods:
Index.GetTypoTolerance()
Index.UpdateTypoTolerance(params)
Index.ResetTypoTolerance()

closed #288

@alallema alallema requested a review from brunoocasali May 2, 2022 08:02
@alallema alallema linked an issue May 2, 2022 that may be closed by this pull request
5 tasks
@alallema alallema added the enhancement New feature or request label May 2, 2022
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

I have some comments, since this is one of my "first" GoLang reviews :)

endpoint: "/indexes/" + i.UID + "/settings/typo-tolerance",
method: http.MethodPost,
contentType: contentTypeJSON,
withRequest: &request,
Copy link
Member

Choose a reason for hiding this comment

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

Can you enlighten me on this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object doesn't really exist in go, so to send multiple arguments it's easier to use struct. For this purpose, we create this struct with all data we need to process a request:

type internalRequest struct {
	endpoint    string
	method      string
	contentType string

	withRequest     interface{}
	withResponse    interface{}
	withQueryParams map[string]string

	acceptedStatusCodes []int

	functionName string
}

We send the struct to the eexecuteRequestfunction with all the data needed, and ainterface{}inwithRequest` who will be fill with the response from the API.

index_settings_test.go Show resolved Hide resolved
index_settings_test.go Show resolved Hide resolved
index_settings_test.go Show resolved Hide resolved
index_settings_test.go Show resolved Hide resolved
@@ -1222,6 +1320,15 @@ func TestIndex_UpdateSettings(t *testing.T) {
SortableAttributes: []string{
"title",
},
TypoTolerance: &TypoTolerance{
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to check in every assertion if the object is equal to another object? What do you think about making the assertions with the part you need?

I saw a lot of changed tests with TypoTolerance stuff which did not concern them!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what you mean. Can you explain a little more?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but I think the answer will be "the tests are autogenerated" haha.

What I mean is, if in the test "update typo tolerance using settings" we just update one field, we don't need to assert every other field, just we want to be changed.

types.go Outdated Show resolved Hide resolved
types_easyjson.go Show resolved Hide resolved
@alallema alallema requested a review from brunoocasali May 3, 2022 12:20
@alallema alallema merged commit 85c5c4c into bump-meilisearch-v0.27.0 May 4, 2022
@alallema alallema deleted the typo-tolerance branch May 4, 2022 12:34
bors bot added a commit that referenced this pull request May 9, 2022
286: Changes related to the next Meilisearch release (v0.27.0) r=curquiza a=meili-bot

Related to this issue: meilisearch/integration-guides#190

This PR:
- gathers the changes related to the next Meilisearch release (v0.27.0) so that this package is ready when the official release is out.
- should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases).
- might eventually contain test failures until the Meilisearch v0.27.0 is out.

⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.27.0) is out.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._

Done:
- #287 
- #289
- #290 
- #291 
- #294
- #293 

# Release
**:warning:** The go package didn't need a version update CI will publish the package once the `Publish release` will be done. However, a version file exists and this is only for analytics but it already is on the next version (the v0.19.1).

This version makes this package compatible with MeiliSearch v0.27.0🎉 
Check out the changelog of [MeiliSearch v0.27.0](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.27.0) for more information about the changes.

## 🚀 Enhancements

* Feature/Analytics (#279) `@brunoocasali`
* Add new methods for the new typo tolerance settings #294 `@alallema`
`Index.GetTypoTolerance()`
`Index.UpdateTypoTolerance(params)`
`Index.ResetTypoTolerance()`
* Ensure nested field support #290 `@alallema`
* Add new search parameters highlightPreTag, highlightPostTag and cropMarker #291 `@alallema`


Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Co-authored-by: Amélie <alallema@users.noreply.github.com>
Co-authored-by: alallema <amelie@meilisearch.com>
bors bot added a commit that referenced this pull request Jul 26, 2022
330: Add pagination setting code samples and fix code sample typos r=alallema a=GoryMoon

Based on the comments from #329 this adds code samples for the pagination settings added in #328.

It also includes some typo fixes from the additions in #294.


Co-authored-by: GoryMoon <gurreja@gmail.com>
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.

Add support to the typo tolerance customization
2 participants