Repository: meilisearch/meilisearch-go

Issue:
[v1.12.0] New index settings: `facetSearch` and `prefixSearch`
*Following the [changes related to Meilisearch v1.12.0 mega issue](https://github.com/meilisearch/integration-guides/issues/307)*

## Description

Add features introduced in [Meilisearch v1.12.0](https://github.com/meilisearch/meilisearch/releases/tag/v1.12.0): the `facetSearch` and `prefixSearch` index settings.

For more information refer to the docs:
- [Facet search](https://www.meilisearch.com/docs/reference/api/settings#facet-search)
- [Prefix search](https://www.meilisearch.com/docs/reference/api/settings#prefix-search)

For reference, here is how these methods were implemented in JavaScript within [meilisearch-js](https://github.com/meilisearch/meilisearch-js):

```js
// get prefix search settings
const settings = await client.index('myIndex').getPrefixSearch()
// disable prefix search
await client.index('myIndex').updatePrefixSearch('disabled')
// reset prefix search settings
await client.index('myIndex').resetPrefixSearch()

// get facet search settings
const settings = await client.index('myIndex').getFacetSearch()
// disable facet search
await client.index('myIndex').updateFacetSearch(false)
// reset facet search settings
await client.index('myIndex').resetFacetSearch()
```

## Implementation

**Tasks:**
- [ ] Add the relevant methods to configure `facetSearch` and `prefixSearch` index settings.
- [ ] The methods associated with the `/settings` API route (to get, reset and update the settings globally) must be able to receive in the payload the new `facetSearch` and `prefixSearch` fields (in [meilisearch-js](https://github.com/meilisearch/meilisearch-js), the equivalent methods are `getSettings()`, `updateSettings()`, and `resetSettings()`)
- [ ] ⚠️ Add integration tests ⚠️
- [ ] Update the code samples in `.code-samples.meilisearch.yaml` to for the following keys, using the [same example as their curl counterpart](https://github.com/meilisearch/documentation/blob/main/.code-samples.meilisearch.yaml):
  - [ ] Add example for `get_facet_search_settings_1`
  - [ ] Add example for `update_facet_search_settings_1`
  - [ ] Add example for `reset_facet_search_settings_1`
  - [ ] Add example for `get_prefix_search_settings_1`
  - [ ] Add example for `update_prefix_search_settings_1`
  - [ ] Add example for `reset_prefix_search_settings_1`


Discussion:

Solution patch:
diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml
index 263d8a6..c71c426 100644
--- a/.code-samples.meilisearch.yaml
+++ b/.code-samples.meilisearch.yaml
@@ -943,3 +943,15 @@ update_localized_attribute_settings_1: |-
   })
 reset_localized_attribute_settings_1: |-
   client.index("INDEX_NAME").ResetLocalizedAttributes()
+get_facet_search_settings_1: |-
+  client.Index("books").GetFacetSearch()
+update_facet_search_settings_1: |-
+  client.Index("books").UpdateFacetSearch(false)
+reset_facet_search_settings_1: |-
+  client.Index("books").ResetFacetSearch()
+get_prefix_search_settings_1: |-
+  client.Index("books").GetPrefixSearch()
+update_prefix_search_settings_1: |-
+  client.Index("books").UpdatePrefixSearch("disabled")
+reset_prefix_search_settings_1: |-
+  client.Index("books").ResetPrefixSearch()
diff --git a/index_interface.go b/index_interface.go
index 8082b53..834cb05 100644
--- a/index_interface.go
+++ b/index_interface.go
@@ -472,6 +472,30 @@ type SettingsManager interface {
 
 	// ResetLocalizedAttributesWithContext reset the localized attributes settings using the provided context for cancellation
 	ResetLocalizedAttributesWithContext(ctx context.Context) (*TaskInfo, error)
+
+	// UpdatePrefixSearch updates the prefix search setting of the index.
+	UpdatePrefixSearch(request string) (*TaskInfo, error)
+
+	// UpdatePrefixSearchWithContext updates the prefix search setting of the index using the provided context for cancellation.
+	UpdatePrefixSearchWithContext(ctx context.Context, request string) (*TaskInfo, error)
+
+	// ResetPrefixSearch resets the prefix search setting of the index to default value.
+	ResetPrefixSearch() (*TaskInfo, error)
+
+	// ResetPrefixSearchWithContext resets the prefix search setting of the index to default value using the provided context for cancellation.
+	ResetPrefixSearchWithContext(ctx context.Context) (*TaskInfo, error)
+
+	// UpdateFacetSearch updates the facet search setting of the index.
+	UpdateFacetSearch(request bool) (*TaskInfo, error)
+
+	// UpdateFacetSearchWithContext updates the facet search setting of the index using the provided context for cancellation.
+	UpdateFacetSearchWithContext(ctx context.Context, request bool) (*TaskInfo, error)
+
+	// ResetFacetSearch resets the facet search setting of the index to default value.
+	ResetFacetSearch() (*TaskInfo, error)
+
+	// ResetFacetSearchWithContext resets the facet search setting of the index to default value using the provided context for cancellation.
+	ResetFacetSearchWithContext(ctx context.Context) (*TaskInfo, error)
 }
 
 type SettingsReader interface {
@@ -614,4 +638,16 @@ type SettingsReader interface {
 	// GetLocalizedAttributesWithContext get the localized attributes settings of an index using the provided context for cancellation
 	// https://www.meilisearch.com/docs/reference/api/settings#get-localized-attributes-settings
 	GetLocalizedAttributesWithContext(ctx context.Context) ([]*LocalizedAttributes, error)
+
+	// GetPrefixSearch retrieves the prefix search setting of the index.
+	GetPrefixSearch() (*string, error)
+
+	// GetPrefixSearchWithContext retrieves the prefix search setting of the index using the provided context for cancellation.
+	GetPrefixSearchWithContext(ctx context.Context) (*string, error)
+
+	// GetFacetSearch retrieves the facet search setting of the index.
+	GetFacetSearch() (bool, error)
+
+	// GetFacetSearchWithContext retrieves the facet search setting of the index using the provided context for cancellation.
+	GetFacetSearchWithContext(ctx context.Context) (bool, error)
 }
diff --git a/index_settings.go b/index_settings.go
index ae4d2af..f110b28 100644
--- a/index_settings.go
+++ b/index_settings.go
@@ -1164,3 +1164,125 @@ func (i *index) ResetLocalizedAttributesWithContext(ctx context.Context) (*TaskI
 	}
 	return resp, nil
 }
+
+func (i *index) GetPrefixSearch() (*string, error) {
+	return i.GetPrefixSearchWithContext(context.Background())
+}
+
+func (i *index) GetPrefixSearchWithContext(ctx context.Context) (*string, error) {
+	resp := new(string)
+	req := &internalRequest{
+		endpoint:            "/indexes/" + i.uid + "/settings/prefix-search",
+		method:              http.MethodGet,
+		withRequest:         nil,
+		withResponse:        resp,
+		acceptedStatusCodes: []int{http.StatusOK},
+		functionName:        "GetPrefixSearch",
+	}
+	if err := i.client.executeRequest(ctx, req); err != nil {
+		return nil, err
+	}
+	return resp, nil
+}
+
+func (i *index) UpdatePrefixSearch(request string) (*TaskInfo, error) {
+	return i.UpdatePrefixSearchWithContext(context.Background(), request)
+}
+
+func (i *index) UpdatePrefixSearchWithContext(ctx context.Context, request string) (*TaskInfo, error) {
+	resp := new(TaskInfo)
+	req := &internalRequest{
+		endpoint:            "/indexes/" + i.uid + "/settings/prefix-search",
+		method:              http.MethodPut,
+		contentType:         contentTypeJSON,
+		withRequest:         &request,
+		withResponse:        resp,
+		acceptedStatusCodes: []int{http.StatusAccepted},
+		functionName:        "UpdatePrefixSearch",
+	}
+	if err := i.client.executeRequest(ctx, req); err != nil {
+		return nil, err
+	}
+	return resp, nil
+}
+
+func (i *index) ResetPrefixSearch() (*TaskInfo, error) {
+	return i.ResetPrefixSearchWithContext(context.Background())
+}
+
+func (i *index) ResetPrefixSearchWithContext(ctx context.Context) (*TaskInfo, error) {
+	resp := new(TaskInfo)
+	req := &internalRequest{
+		endpoint:            "/indexes/" + i.uid + "/settings/prefix-search",
+		method:              http.MethodDelete,
+		withRequest:         nil,
+		withResponse:        resp,
+		acceptedStatusCodes: []int{http.StatusAccepted},
+		functionName:        "ResetPrefixSearch",
+	}
+	if err := i.client.executeRequest(ctx, req); err != nil {
+		return nil, err
+	}
+	return resp, nil
+}
+
+func (i *index) GetFacetSearch() (bool, error) {
+	return i.GetFacetSearchWithContext(context.Background())
+}
+
+func (i *index) GetFacetSearchWithContext(ctx context.Context) (bool, error) {
+	var resp bool
+	req := &internalRequest{
+		endpoint:            "/indexes/" + i.uid + "/settings/facet-search",
+		method:              http.MethodGet,
+		withRequest:         nil,
+		withResponse:        &resp,
+		acceptedStatusCodes: []int{http.StatusOK},
+		functionName:        "GetFacetSearch",
+	}
+	if err := i.client.executeRequest(ctx, req); err != nil {
+		return false, err
+	}
+	return resp, nil
+}
+
+func (i *index) UpdateFacetSearch(request bool) (*TaskInfo, error) {
+	return i.UpdateFacetSearchWithContext(context.Background(), request)
+}
+
+func (i *index) UpdateFacetSearchWithContext(ctx context.Context, request bool) (*TaskInfo, error) {
+	resp := new(TaskInfo)
+	req := &internalRequest{
+		endpoint:            "/indexes/" + i.uid + "/settings/facet-search",
+		method:              http.MethodPut,
+		contentType:         contentTypeJSON,
+		withRequest:         &request,
+		withResponse:        resp,
+		acceptedStatusCodes: []int{http.StatusAccepted},
+		functionName:        "UpdateFacetSearch",
+	}
+	if err := i.client.executeRequest(ctx, req); err != nil {
+		return nil, err
+	}
+	return resp, nil
+}
+
+func (i *index) ResetFacetSearch() (*TaskInfo, error) {
+	return i.ResetFacetSearchWithContext(context.Background())
+}
+
+func (i *index) ResetFacetSearchWithContext(ctx context.Context) (*TaskInfo, error) {
+	resp := new(TaskInfo)
+	req := &internalRequest{
+		endpoint:            "/indexes/" + i.uid + "/settings/facet-search",
+		method:              http.MethodDelete,
+		withRequest:         nil,
+		withResponse:        resp,
+		acceptedStatusCodes: []int{http.StatusAccepted},
+		functionName:        "ResetFacetSearch",
+	}
+	if err := i.client.executeRequest(ctx, req); err != nil {
+		return nil, err
+	}
+	return resp, nil
+}
diff --git a/types.go b/types.go
index 7e29ae8..da91deb 100644
--- a/types.go
+++ b/types.go
@@ -87,6 +87,8 @@ type Settings struct {
 	Pagination           *Pagination            `json:"pagination,omitempty"`
 	Faceting             *Faceting              `json:"faceting,omitempty"`
 	Embedders            map[string]Embedder    `json:"embedders,omitempty"`
+	PrefixSearch         *string                `json:"prefixSearch,omitempty"`
+	FacetSearch          bool                   `json:"facetSearch,omitempty"`
 }
 
 type LocalizedAttributes struct {
diff --git a/types_easyjson.go b/types_easyjson.go
index e768631..4f62dd7 100644
--- a/types_easyjson.go
+++ b/types_easyjson.go
@@ -2508,6 +2508,18 @@ func easyjson6601e8cdDecodeGithubComMeilisearchMeilisearchGo16(in *jlexer.Lexer,
 				}
 				in.Delim('}')
 			}
+		case "prefixSearch":
+			if in.IsNull() {
+				in.Skip()
+				out.PrefixSearch = nil
+			} else {
+				if out.PrefixSearch == nil {
+					out.PrefixSearch = new(string)
+				}
+				*out.PrefixSearch = string(in.String())
+			}
+		case "facetSearch":
+			out.FacetSearch = bool(in.Bool())
 		default:
 			in.SkipRecursive()
 		}
@@ -2831,6 +2843,26 @@ func easyjson6601e8cdEncodeGithubComMeilisearchMeilisearchGo16(out *jwriter.Writ
 			out.RawByte('}')
 		}
 	}
+	if in.PrefixSearch != nil {
+		const prefix string = ",\"prefixSearch\":"
+		if first {
+			first = false
+			out.RawString(prefix[1:])
+		} else {
+			out.RawString(prefix)
+		}
+		out.String(string(*in.PrefixSearch))
+	}
+	if in.FacetSearch {
+		const prefix string = ",\"facetSearch\":"
+		if first {
+			first = false
+			out.RawString(prefix[1:])
+		} else {
+			out.RawString(prefix)
+		}
+		out.Bool(bool(in.FacetSearch))
+	}
 	out.RawByte('}')
 }
 



Test patch:
diff --git a/index_settings_test.go b/index_settings_test.go
index ad4e97b..6c91329 100644
--- a/index_settings_test.go
+++ b/index_settings_test.go
@@ -260,6 +260,8 @@ func TestIndex_GetSettings(t *testing.T) {
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
 				LocalizedAttributes:  nil,
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -286,6 +288,8 @@ func TestIndex_GetSettings(t *testing.T) {
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
 				LocalizedAttributes:  nil,
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 	}
@@ -896,6 +900,8 @@ func TestIndex_ResetSettings(t *testing.T) {
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
 				LocalizedAttributes:  nil,
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -924,6 +930,8 @@ func TestIndex_ResetSettings(t *testing.T) {
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
 				LocalizedAttributes:  nil,
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 	}
@@ -1708,6 +1716,8 @@ func TestIndex_UpdateSettings(t *testing.T) {
 							AttributePatterns: []string{"*_ja"},
 						},
 					},
+					PrefixSearch: stringPtr("indexingTime"),
+					FacetSearch:  true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -1736,6 +1746,8 @@ func TestIndex_UpdateSettings(t *testing.T) {
 						AttributePatterns: []string{"*_ja"},
 					},
 				},
+				PrefixSearch: stringPtr("indexingTime"),
+				FacetSearch:  true,
 			},
 		},
 		{
@@ -1789,6 +1801,8 @@ func TestIndex_UpdateSettings(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -1811,6 +1825,8 @@ func TestIndex_UpdateSettings(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch: stringPtr("indexingTime"),
+				FacetSearch:  true,
 			},
 		},
 	}
@@ -1886,6 +1902,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 				secondRequest: Settings{
 					Synonyms: map[string][]string{
@@ -1912,6 +1930,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -1933,6 +1953,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -1968,6 +1990,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 				secondRequest: Settings{
 					Synonyms: map[string][]string{
@@ -1994,6 +2018,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2015,6 +2041,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2050,6 +2078,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 				secondRequest: Settings{
 					SearchableAttributes: []string{
@@ -2076,6 +2106,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2097,6 +2129,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2132,6 +2166,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 				secondRequest: Settings{
 					DisplayedAttributes: []string{
@@ -2158,6 +2194,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2179,6 +2217,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2214,6 +2254,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 				secondRequest: Settings{
 					StopWords: []string{
@@ -2240,6 +2282,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2261,6 +2305,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2296,6 +2342,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 				secondRequest: Settings{
 					FilterableAttributes: []string{
@@ -2322,6 +2370,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2343,6 +2393,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2378,6 +2430,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 				secondRequest: Settings{
 					SortableAttributes: []string{
@@ -2404,6 +2458,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2425,6 +2481,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2472,6 +2530,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:      make([]string, 0),
 					NonSeparatorTokens:   make([]string, 0),
 					Dictionary:           make([]string, 0),
+					PrefixSearch:         stringPtr("indexingTime"),
+					FacetSearch:          true,
 				},
 				secondRequest: Settings{
 					TypoTolerance: &TypoTolerance{
@@ -2518,6 +2578,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2539,6 +2601,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2574,6 +2638,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 				secondRequest: Settings{
 					Pagination: &Pagination{
@@ -2600,6 +2666,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2621,6 +2689,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2659,6 +2729,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 				secondRequest: Settings{
 					Faceting: &Faceting{
@@ -2688,6 +2760,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2709,6 +2783,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 		{
@@ -2745,6 +2821,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 				secondRequest: Settings{
 					RankingRules: []string{
@@ -2775,6 +2853,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 					SeparatorTokens:    make([]string, 0),
 					NonSeparatorTokens: make([]string, 0),
 					Dictionary:         make([]string, 0),
+					PrefixSearch:       stringPtr("indexingTime"),
+					FacetSearch:        true,
 				},
 			},
 			wantTask: &TaskInfo{
@@ -2796,6 +2876,8 @@ func TestIndex_UpdateSettingsOneByOne(t *testing.T) {
 				SeparatorTokens:      make([]string, 0),
 				NonSeparatorTokens:   make([]string, 0),
 				Dictionary:           make([]string, 0),
+				PrefixSearch:         stringPtr("indexingTime"),
+				FacetSearch:          true,
 			},
 		},
 	}
@@ -3797,3 +3879,334 @@ func Test_LocalizedAttributes(t *testing.T) {
 		require.Error(t, err)
 	})
 }
+
+func TestIndex_GetPrefixSearch(t *testing.T) {
+	meili := setup(t, "")
+	customMeili := setup(t, "", WithCustomClientWithTLS(&tls.Config{
+		InsecureSkipVerify: true,
+	}))
+
+	type args struct {
+		UID    string
+		client ServiceManager
+	}
+	tests := []struct {
+		name     string
+		args     args
+		wantResp *string
+	}{
+		{
+			name: "TestIndexBasicGetPrefixSearch",
+			args: args{
+				UID:    "indexUID",
+				client: meili,
+			},
+			wantResp: stringPtr("indexingTime"),
+		},
+		{
+			name: "TestIndexGetPrefixSearchWithCustomClient",
+			args: args{
+				UID:    "indexUID",
+				client: customMeili,
+			},
+			wantResp: stringPtr("indexingTime"),
+		},
+	}
+	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))
+
+			gotResp, err := i.GetPrefixSearch()
+			require.NoError(t, err)
+			require.Equal(t, tt.wantResp, gotResp)
+		})
+	}
+}
+
+func TestIndex_UpdatePrefixSearch(t *testing.T) {
+	meili := setup(t, "")
+	customMeili := setup(t, "", WithCustomClientWithTLS(&tls.Config{
+		InsecureSkipVerify: true,
+	}))
+
+	type args struct {
+		UID     string
+		client  ServiceManager
+		request string
+	}
+	tests := []struct {
+		name     string
+		args     args
+		wantTask *TaskInfo
+		wantResp *string
+	}{
+		{
+			name: "TestIndexBasicUpdatePrefixSearch",
+			args: args{
+				UID:     "indexUID",
+				client:  meili,
+				request: "disabled",
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: stringPtr("disabled"),
+		},
+		{
+			name: "TestIndexUpdatePrefixSearchWithCustomClient",
+			args: args{
+				UID:     "indexUID",
+				client:  customMeili,
+				request: "disabled",
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: stringPtr("disabled"),
+		},
+	}
+	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.UpdatePrefixSearch(tt.args.request)
+			require.NoError(t, err)
+			require.GreaterOrEqual(t, gotTask.TaskUID, tt.wantTask.TaskUID)
+			testWaitForTask(t, i, gotTask)
+
+			gotResp, err := i.GetPrefixSearch()
+			require.NoError(t, err)
+			require.Equal(t, tt.wantResp, gotResp)
+		})
+	}
+}
+
+func TestIndex_ResetPrefixSearch(t *testing.T) {
+	meili := setup(t, "")
+	customMeili := setup(t, "", WithCustomClientWithTLS(&tls.Config{
+		InsecureSkipVerify: true,
+	}))
+
+	type args struct {
+		UID    string
+		client ServiceManager
+	}
+	tests := []struct {
+		name     string
+		args     args
+		wantTask *TaskInfo
+		wantResp *string
+	}{
+		{
+			name: "TestIndexBasicResetPrefixSearch",
+			args: args{
+				UID:    "indexUID",
+				client: meili,
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: stringPtr("indexingTime"),
+		},
+		{
+			name: "TestIndexResetPrefixSearchWithCustomClient",
+			args: args{
+				UID:    "indexUID",
+				client: customMeili,
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: stringPtr("indexingTime"),
+		},
+	}
+	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))
+
+			// First update to a non-default value
+			_, err := i.UpdatePrefixSearch("disabled")
+			require.NoError(t, err)
+
+			gotTask, err := i.ResetPrefixSearch()
+			require.NoError(t, err)
+			require.GreaterOrEqual(t, gotTask.TaskUID, tt.wantTask.TaskUID)
+			testWaitForTask(t, i, gotTask)
+
+			gotResp, err := i.GetPrefixSearch()
+			require.NoError(t, err)
+			require.Equal(t, tt.wantResp, gotResp)
+		})
+	}
+}
+
+func TestIndex_GetFacetSearch(t *testing.T) {
+	meili := setup(t, "")
+	customMeili := setup(t, "", WithCustomClientWithTLS(&tls.Config{
+		InsecureSkipVerify: true,
+	}))
+
+	type args struct {
+		UID    string
+		client ServiceManager
+	}
+	tests := []struct {
+		name     string
+		args     args
+		wantResp bool
+	}{
+		{
+			name: "TestIndexBasicGetFacetSearch",
+			args: args{
+				UID:    "indexUID",
+				client: meili,
+			},
+			wantResp: boolPtr(true),
+		},
+		{
+			name: "TestIndexGetFacetSearchWithCustomClient",
+			args: args{
+				UID:    "indexUID",
+				client: customMeili,
+			},
+			wantResp: boolPtr(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))
+
+			gotResp, err := i.GetFacetSearch()
+			require.NoError(t, err)
+			require.Equal(t, tt.wantResp, gotResp)
+		})
+	}
+}
+
+func TestIndex_UpdateFacetSearch(t *testing.T) {
+	meili := setup(t, "")
+	customMeili := setup(t, "", WithCustomClientWithTLS(&tls.Config{
+		InsecureSkipVerify: true,
+	}))
+
+	type args struct {
+		UID     string
+		client  ServiceManager
+		request bool
+	}
+	tests := []struct {
+		name     string
+		args     args
+		wantTask *TaskInfo
+		wantResp bool
+	}{
+		{
+			name: "TestIndexBasicUpdateFacetSearch",
+			args: args{
+				UID:     "indexUID",
+				client:  meili,
+				request: false,
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: boolPtr(false),
+		},
+		{
+			name: "TestIndexUpdateFacetSearchWithCustomClient",
+			args: args{
+				UID:     "indexUID",
+				client:  customMeili,
+				request: false,
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: boolPtr(false),
+		},
+	}
+	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.UpdateFacetSearch(tt.args.request)
+			require.NoError(t, err)
+			require.GreaterOrEqual(t, gotTask.TaskUID, tt.wantTask.TaskUID)
+			testWaitForTask(t, i, gotTask)
+
+			gotResp, err := i.GetFacetSearch()
+			require.NoError(t, err)
+			require.Equal(t, tt.wantResp, gotResp)
+		})
+	}
+}
+
+func TestIndex_ResetFacetSearch(t *testing.T) {
+	meili := setup(t, "")
+	customMeili := setup(t, "", WithCustomClientWithTLS(&tls.Config{
+		InsecureSkipVerify: true,
+	}))
+
+	type args struct {
+		UID    string
+		client ServiceManager
+	}
+	tests := []struct {
+		name     string
+		args     args
+		wantTask *TaskInfo
+		wantResp bool
+	}{
+		{
+			name: "TestIndexBasicResetFacetSearch",
+			args: args{
+				UID:    "indexUID",
+				client: meili,
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: boolPtr(true),
+		},
+		{
+			name: "TestIndexResetFacetSearchWithCustomClient",
+			args: args{
+				UID:    "indexUID",
+				client: customMeili,
+			},
+			wantTask: &TaskInfo{TaskUID: 1},
+			wantResp: boolPtr(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))
+
+			// First update to a non-default value
+			_, err := i.UpdateFacetSearch(false)
+			require.NoError(t, err)
+
+			gotTask, err := i.ResetFacetSearch()
+			require.NoError(t, err)
+			require.GreaterOrEqual(t, gotTask.TaskUID, tt.wantTask.TaskUID)
+			testWaitForTask(t, i, gotTask)
+
+			gotResp, err := i.GetFacetSearch()
+			require.NoError(t, err)
+			require.Equal(t, tt.wantResp, gotResp)
+		})
+	}
+}
+
+// Helper functions
+func stringPtr(s string) *string {
+	return &s
+}
+
+func boolPtr(b bool) bool {
+	return b
+}