@@ -828,6 +828,39 @@ impl<Http: HttpClient> Index<Http> {
828828 . await
829829 }
830830
831+ /// Get [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) of the [Index].
832+ ///
833+ /// # Example
834+ ///
835+ /// ```
836+ /// # use meilisearch_sdk::{client::*, indexes::*};
837+ /// #
838+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
839+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
840+ /// #
841+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
842+ /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
843+ /// # client.create_index("get_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
844+ /// let index = client.index("get_prefix_search");
845+ ///
846+ /// let prefix_search = index.get_prefix_search().await.unwrap();
847+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
848+ /// # });
849+ /// ```
850+ pub async fn get_prefix_search ( & self ) -> Result < String , Error > {
851+ self . client
852+ . http_client
853+ . request :: < ( ) , ( ) , String > (
854+ & format ! (
855+ "{}/indexes/{}/settings/prefix-search" ,
856+ self . client. host, self . uid
857+ ) ,
858+ Method :: Get { query : ( ) } ,
859+ 200 ,
860+ )
861+ . await
862+ }
863+
831864 /// Get [typo tolerance](https://www.meilisearch.com/docs/learn/configuration/typo_tolerance#typo-tolerance) of the [Index].
832865 ///
833866 /// ```
@@ -1701,6 +1734,45 @@ impl<Http: HttpClient> Index<Http> {
17011734 . await
17021735 }
17031736
1737+ /// update [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) settings of the [Index].
1738+ ///
1739+ /// # Example
1740+ ///
1741+ /// ```
1742+ /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1743+ /// #
1744+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1745+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1746+ /// #
1747+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1748+ /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1749+ /// # client.create_index("set_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1750+ /// let mut index = client.index("set_prefix_search");
1751+ ///
1752+ /// let task = index.set_prefix_search("disabled".to_string()).await.unwrap();
1753+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1754+ /// # });
1755+ /// ```
1756+ pub async fn set_prefix_search (
1757+ & self ,
1758+ prefix_search : String ,
1759+ ) -> Result < TaskInfo , Error > {
1760+ self . client
1761+ . http_client
1762+ . request :: < ( ) , String , TaskInfo > (
1763+ & format ! (
1764+ "{}/indexes/{}/settings/prefix-search" ,
1765+ self . client. host, self . uid
1766+ ) ,
1767+ Method :: Put {
1768+ query : ( ) ,
1769+ body : prefix_search,
1770+ } ,
1771+ 202 ,
1772+ )
1773+ . await
1774+ }
1775+
17041776 /// Update [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
17051777 ///
17061778 /// # Example
@@ -2277,6 +2349,39 @@ impl<Http: HttpClient> Index<Http> {
22772349 . await
22782350 }
22792351
2352+ /// Reset [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) settings of the [Index].
2353+ ///
2354+ /// # Example
2355+ ///
2356+ /// ```
2357+ /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2358+ /// #
2359+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2360+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2361+ /// #
2362+ /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2363+ /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2364+ /// # client.create_index("reset_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2365+ /// let mut index = client.index("reset_prefix_search");
2366+ ///
2367+ /// let task = index.reset_prefix_search().await.unwrap();
2368+ /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2369+ /// # });
2370+ /// ```
2371+ pub async fn reset_prefix_search ( & self ) -> Result < TaskInfo , Error > {
2372+ self . client
2373+ . http_client
2374+ . request :: < ( ) , ( ) , TaskInfo > (
2375+ & format ! (
2376+ "{}/indexes/{}/settings/prefix-search" ,
2377+ self . client. host, self . uid
2378+ ) ,
2379+ Method :: Delete { query : ( ) } ,
2380+ 202 ,
2381+ )
2382+ . await
2383+ }
2384+
22802385 /// Reset [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
22812386 ///
22822387 /// # Example
@@ -2705,6 +2810,48 @@ mod tests {
27052810 assert_eq ! ( expected, default ) ;
27062811 }
27072812
2813+ #[ meilisearch_test]
2814+ async fn test_get_prefix_search ( index : Index ) {
2815+ let expected = "indexingTime" . to_string ( ) ;
2816+
2817+ let res = index. get_prefix_search ( ) . await . unwrap ( ) ;
2818+
2819+ assert_eq ! ( expected, res) ;
2820+ }
2821+
2822+ #[ meilisearch_test]
2823+ async fn test_set_prefix_search ( client : Client , index : Index ) {
2824+ let expected = "disabled" . to_string ( ) ;
2825+
2826+ let task_info = index
2827+ . set_prefix_search ( "disabled" . to_string ( ) )
2828+ . await
2829+ . unwrap ( ) ;
2830+ client. wait_for_task ( task_info, None , None ) . await . unwrap ( ) ;
2831+
2832+ let res = index. get_prefix_search ( ) . await . unwrap ( ) ;
2833+
2834+ assert_eq ! ( expected, res) ;
2835+ }
2836+
2837+ #[ meilisearch_test]
2838+ async fn test_reset_prefix_search ( index : Index ) {
2839+ let expected = "indexingTime" . to_string ( ) ;
2840+
2841+ let task = index
2842+ . set_prefix_search ( "disabled" . to_string ( ) )
2843+ . await
2844+ . unwrap ( ) ;
2845+ index. wait_for_task ( task, None , None ) . await . unwrap ( ) ;
2846+
2847+ let reset_task = index. reset_prefix_search ( ) . await . unwrap ( ) ;
2848+ index. wait_for_task ( reset_task, None , None ) . await . unwrap ( ) ;
2849+
2850+ let default = index. get_prefix_search ( ) . await . unwrap ( ) ;
2851+
2852+ assert_eq ! ( expected, default ) ;
2853+ }
2854+
27082855 #[ meilisearch_test]
27092856 async fn test_get_search_cutoff_ms ( index : Index ) {
27102857 let expected = None ;
0 commit comments