Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion integration/index_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3354,6 +3354,8 @@ func TestIndex_UpdateTypoTolerance(t *testing.T) {
customMeili := setup(t, "", meilisearch.WithCustomClientWithTLS(&tls.Config{
InsecureSkipVerify: true,
}))
t.Cleanup(cleanup(meili))
t.Cleanup(cleanup(customMeili))

type args struct {
UID string
Expand Down Expand Up @@ -3520,13 +3522,42 @@ func TestIndex_UpdateTypoTolerance(t *testing.T) {
DisableOnNumbers: false,
},
},
{
name: "TestIndexZeroMinWordSizeForTypos",
args: args{
UID: "indexUID",
client: meili,
request: meilisearch.TypoTolerance{
Enabled: true,
MinWordSizeForTypos: meilisearch.MinWordSizeForTypos{
OneTypo: 0,
TwoTypos: 0,
},
DisableOnWords: []string{},
DisableOnAttributes: []string{},
DisableOnNumbers: true,
},
},
wantTask: &meilisearch.TaskInfo{
TaskUID: 1,
},
wantResp: &meilisearch.TypoTolerance{
Enabled: true,
MinWordSizeForTypos: meilisearch.MinWordSizeForTypos{
OneTypo: 0,
TwoTypos: 0,
},
DisableOnWords: []string{},
DisableOnAttributes: []string{},
DisableOnNumbers: true,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
setUpIndexForFaceting(tt.args.client)
c := tt.args.client
i := c.Index(tt.args.UID)
t.Cleanup(cleanup(c))

gotTask, err := i.UpdateTypoTolerance(&tt.args.request)
require.NoError(t, err)
Expand Down
12 changes: 6 additions & 6 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,16 @@ type LocalizedAttributes struct {
// TypoTolerance is the type that represents the typo tolerance setting in meilisearch
type TypoTolerance struct {
Enabled bool `json:"enabled"`
MinWordSizeForTypos MinWordSizeForTypos `json:"minWordSizeForTypos,omitempty"`
DisableOnWords []string `json:"disableOnWords,omitempty"`
DisableOnAttributes []string `json:"disableOnAttributes,omitempty"`
DisableOnNumbers bool `json:"disableOnNumbers,omitempty"`
MinWordSizeForTypos MinWordSizeForTypos `json:"minWordSizeForTypos"`
DisableOnWords []string `json:"disableOnWords"`
DisableOnAttributes []string `json:"disableOnAttributes"`
DisableOnNumbers bool `json:"disableOnNumbers"`
}

// MinWordSizeForTypos is the type that represents the minWordSizeForTypos setting in the typo tolerance setting in meilisearch
type MinWordSizeForTypos struct {
OneTypo int64 `json:"oneTypo,omitempty"`
TwoTypos int64 `json:"twoTypos,omitempty"`
OneTypo int64 `json:"oneTypo"`
TwoTypos int64 `json:"twoTypos"`
}

// Pagination is the type that represents the pagination setting in meilisearch
Expand Down
Loading