@@ -932,6 +932,72 @@ impl<Http: HttpClient> Index<Http> {
932932 )
933933 . await
934934 }
935+
936+ /// Get [facet-search settings](https://www.meilisearch.com/docs/reference/api/settings#facet-search) of the [Index].
937+ ///
938+ /// # Example
939+ ///
940+ /// ```
941+ /// # use meilisearch_sdk::{client::*, indexes::*};
942+ /// #
943+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
944+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
945+ /// #
946+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
947+ /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
948+ /// # client.create_index("get_facet_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
949+ /// let index = client.index("get_facet_search");
950+ ///
951+ /// let facet_search = index.get_facet_search().await.unwrap();
952+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
953+ /// # });
954+ /// ```
955+ pub async fn get_facet_search ( & self ) -> Result < bool , Error > {
956+ self . client
957+ . http_client
958+ . request :: < ( ) , ( ) , bool > (
959+ & format ! (
960+ "{}/indexes/{}/settings/facet-search" ,
961+ self . client. host, self . uid
962+ ) ,
963+ Method :: Get { query : ( ) } ,
964+ 200 ,
965+ )
966+ . await
967+ }
968+
969+ /// Get [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) of the [Index].
970+ ///
971+ /// # Example
972+ ///
973+ /// ```
974+ /// # use meilisearch_sdk::{client::*, indexes::*};
975+ /// #
976+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
977+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
978+ /// #
979+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
980+ /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
981+ /// # client.create_index("get_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
982+ /// let index = client.index("get_prefix_search");
983+ ///
984+ /// let prefix_search = index.get_prefix_search().await.unwrap();
985+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
986+ /// # });
987+ /// ```
988+ pub async fn get_prefix_search ( & self ) -> Result < String , Error > {
989+ self . client
990+ . http_client
991+ . request :: < ( ) , ( ) , String > (
992+ & format ! (
993+ "{}/indexes/{}/settings/prefix-search" ,
994+ self . client. host, self . uid
995+ ) ,
996+ Method :: Get { query : ( ) } ,
997+ 200 ,
998+ )
999+ . await
1000+ }
9351001
9361002 /// Get [typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#typo-tolerance) of the [Index].
9371003 ///
@@ -1858,6 +1924,78 @@ impl<Http: HttpClient> Index<Http> {
18581924 )
18591925 . await
18601926 }
1927+
1928+ /// update [facet-search settings](https://www.meilisearch.com/docs/reference/api/settings#facet-search) settings of the [Index].
1929+ ///
1930+ /// # Example
1931+ ///
1932+ /// ```
1933+ /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1934+ /// #
1935+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1936+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1937+ /// #
1938+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1939+ /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1940+ /// # client.create_index("set_facet_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1941+ /// let mut index = client.index("set_facet_search");
1942+ ///
1943+ /// let task = index.set_facet_search(false).await.unwrap();
1944+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1945+ /// # });
1946+ /// ```
1947+ pub async fn set_facet_search ( & self , facet_search : bool ) -> Result < TaskInfo , Error > {
1948+ self . client
1949+ . http_client
1950+ . request :: < ( ) , bool , TaskInfo > (
1951+ & format ! (
1952+ "{}/indexes/{}/settings/facet-search" ,
1953+ self . client. host, self . uid
1954+ ) ,
1955+ Method :: Put {
1956+ query : ( ) ,
1957+ body : facet_search,
1958+ } ,
1959+ 202 ,
1960+ )
1961+ . await
1962+ }
1963+
1964+ /// update [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) settings of the [Index].
1965+ ///
1966+ /// # Example
1967+ ///
1968+ /// ```
1969+ /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1970+ /// #
1971+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1972+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1973+ /// #
1974+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1975+ /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1976+ /// # client.create_index("set_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1977+ /// let mut index = client.index("set_prefix_search");
1978+ ///
1979+ /// let task = index.set_prefix_search("disabled".to_string()).await.unwrap();
1980+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1981+ /// # });
1982+ /// ```
1983+ pub async fn set_prefix_search ( & self , prefix_search : String ) -> Result < TaskInfo , Error > {
1984+ self . client
1985+ . http_client
1986+ . request :: < ( ) , String , TaskInfo > (
1987+ & format ! (
1988+ "{}/indexes/{}/settings/prefix-search" ,
1989+ self . client. host, self . uid
1990+ ) ,
1991+ Method :: Put {
1992+ query : ( ) ,
1993+ body : prefix_search,
1994+ } ,
1995+ 202 ,
1996+ )
1997+ . await
1998+ }
18611999
18622000 /// Update [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
18632001 ///
@@ -2434,6 +2572,72 @@ impl<Http: HttpClient> Index<Http> {
24342572 )
24352573 . await
24362574 }
2575+
2576+ /// Reset [facet-search settings](https://www.meilisearch.com/docs/reference/api/settings#facet-search) settings of the [Index].
2577+ ///
2578+ /// # Example
2579+ ///
2580+ /// ```
2581+ /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2582+ /// #
2583+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2584+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2585+ /// #
2586+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2587+ /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2588+ /// # client.create_index("reset_facet_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2589+ /// let mut index = client.index("reset_facet_search");
2590+ ///
2591+ /// let task = index.reset_facet_search().await.unwrap();
2592+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2593+ /// # });
2594+ /// ```
2595+ pub async fn reset_facet_search ( & self ) -> Result < TaskInfo , Error > {
2596+ self . client
2597+ . http_client
2598+ . request :: < ( ) , ( ) , TaskInfo > (
2599+ & format ! (
2600+ "{}/indexes/{}/settings/facet-search" ,
2601+ self . client. host, self . uid
2602+ ) ,
2603+ Method :: Delete { query : ( ) } ,
2604+ 202 ,
2605+ )
2606+ . await
2607+ }
2608+
2609+ /// Reset [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) settings of the [Index].
2610+ ///
2611+ /// # Example
2612+ ///
2613+ /// ```
2614+ /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2615+ /// #
2616+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2617+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2618+ /// #
2619+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2620+ /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2621+ /// # client.create_index("reset_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2622+ /// let mut index = client.index("reset_prefix_search");
2623+ ///
2624+ /// let task = index.reset_prefix_search().await.unwrap();
2625+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2626+ /// # });
2627+ /// ```
2628+ pub async fn reset_prefix_search ( & self ) -> Result < TaskInfo , Error > {
2629+ self . client
2630+ . http_client
2631+ . request :: < ( ) , ( ) , TaskInfo > (
2632+ & format ! (
2633+ "{}/indexes/{}/settings/prefix-search" ,
2634+ self . client. host, self . uid
2635+ ) ,
2636+ Method :: Delete { query : ( ) } ,
2637+ 202 ,
2638+ )
2639+ . await
2640+ }
24372641
24382642 /// Reset [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
24392643 ///
@@ -2932,6 +3136,84 @@ mod tests {
29323136
29333137 assert_eq ! ( expected, default ) ;
29343138 }
3139+
3140+ #[ meilisearch_test]
3141+ async fn test_get_facet_search ( index : Index ) {
3142+ let expected = true ;
3143+
3144+ let res = index. get_facet_search ( ) . await . unwrap ( ) ;
3145+
3146+ assert_eq ! ( expected, res) ;
3147+ }
3148+
3149+ #[ meilisearch_test]
3150+ async fn test_set_facet_search ( client : Client , index : Index ) {
3151+ let expected = false ;
3152+
3153+ let task_info = index. set_facet_search ( false ) . await . unwrap ( ) ;
3154+ client. wait_for_task ( task_info, None , None ) . await . unwrap ( ) ;
3155+
3156+ let res = index. get_facet_search ( ) . await . unwrap ( ) ;
3157+
3158+ assert_eq ! ( expected, res) ;
3159+ }
3160+
3161+ #[ meilisearch_test]
3162+ async fn test_reset_facet_search ( index : Index ) {
3163+ let expected = true ;
3164+
3165+ let task = index. set_facet_search ( false ) . await . unwrap ( ) ;
3166+ index. wait_for_task ( task, None , None ) . await . unwrap ( ) ;
3167+
3168+ let reset_task = index. reset_facet_search ( ) . await . unwrap ( ) ;
3169+ index. wait_for_task ( reset_task, None , None ) . await . unwrap ( ) ;
3170+
3171+ let default = index. get_facet_search ( ) . await . unwrap ( ) ;
3172+
3173+ assert_eq ! ( expected, default ) ;
3174+ }
3175+
3176+ #[ meilisearch_test]
3177+ async fn test_get_prefix_search ( index : Index ) {
3178+ let expected = "indexingTime" . to_string ( ) ;
3179+
3180+ let res = index. get_prefix_search ( ) . await . unwrap ( ) ;
3181+
3182+ assert_eq ! ( expected, res) ;
3183+ }
3184+
3185+ #[ meilisearch_test]
3186+ async fn test_set_prefix_search ( client : Client , index : Index ) {
3187+ let expected = "disabled" . to_string ( ) ;
3188+
3189+ let task_info = index
3190+ . set_prefix_search ( "disabled" . to_string ( ) )
3191+ . await
3192+ . unwrap ( ) ;
3193+ client. wait_for_task ( task_info, None , None ) . await . unwrap ( ) ;
3194+
3195+ let res = index. get_prefix_search ( ) . await . unwrap ( ) ;
3196+
3197+ assert_eq ! ( expected, res) ;
3198+ }
3199+
3200+ #[ meilisearch_test]
3201+ async fn test_reset_prefix_search ( index : Index ) {
3202+ let expected = "indexingTime" . to_string ( ) ;
3203+
3204+ let task = index
3205+ . set_prefix_search ( "disabled" . to_string ( ) )
3206+ . await
3207+ . unwrap ( ) ;
3208+ index. wait_for_task ( task, None , None ) . await . unwrap ( ) ;
3209+
3210+ let reset_task = index. reset_prefix_search ( ) . await . unwrap ( ) ;
3211+ index. wait_for_task ( reset_task, None , None ) . await . unwrap ( ) ;
3212+
3213+ let default = index. get_prefix_search ( ) . await . unwrap ( ) ;
3214+
3215+ assert_eq ! ( expected, default ) ;
3216+ }
29353217
29363218 #[ meilisearch_test]
29373219 async fn test_get_search_cutoff_ms ( index : Index ) {
0 commit comments