@@ -12,20 +12,17 @@ use crate::{indexes::Index, errors::Error, request::{request, Method}, progress:
1212/// let stop_words = vec![String::from("a"), String::from("the"), String::from("of")];
1313///
1414/// let settings = Settings::new()
15- /// .with_stop_words(stop_words.clone())
16- /// .with_accept_new_fields(false);
15+ /// .with_stop_words(stop_words.clone());
1716///
1817/// // OR
1918///
2019/// let mut settings = Settings::new();
2120/// settings.stop_words = Some(stop_words.clone());
22- /// settings.accept_new_fields = Some(false);
2321///
2422/// // OR
2523///
2624/// let settings = Settings {
2725/// stop_words: Some(stop_words.clone()),
28- /// accept_new_fields: Some(false),
2926/// ..Settings::new()
3027/// };
3128/// ```
@@ -53,9 +50,6 @@ pub struct Settings {
5350 /// Fields displayed in the returned documents
5451 #[ serde( skip_serializing_if = "Option::is_none" ) ]
5552 pub displayed_attributes : Option < Vec < String > > ,
56- /// Defines whether new fields should be searchable and displayed or not
57- #[ serde( skip_serializing_if = "Option::is_none" ) ]
58- pub accept_new_fields : Option < bool > ,
5953}
6054
6155#[ allow( missing_docs) ]
@@ -70,7 +64,6 @@ impl Settings {
7064 distinct_attribute : None ,
7165 searchable_attributes : None ,
7266 displayed_attributes : None ,
73- accept_new_fields : None ,
7467 }
7568 }
7669 pub fn with_synonyms ( self , synonyms : HashMap < String , Vec < String > > ) -> Settings {
@@ -115,12 +108,6 @@ impl Settings {
115108 ..self
116109 }
117110 }
118- pub fn with_accept_new_fields ( self , accept_new_fields : bool ) -> Settings {
119- Settings {
120- accept_new_fields : Some ( accept_new_fields) ,
121- ..self
122- }
123- }
124111}
125112
126113impl < ' a > Index < ' a > {
@@ -284,26 +271,6 @@ impl<'a> Index<'a> {
284271 ) . await ?)
285272 }
286273
287- /// Get the [accept-new-fields](https://docs.meilisearch.com/guides/advanced_guides/settings.html#accept-new-fields) value of the Index.
288- ///
289- /// ```
290- /// # use meilisearch_sdk::{client::*, indexes::*, document::*};
291- /// # #[tokio::main]
292- /// # async fn main() {
293- /// let client = Client::new("http://localhost:7700", "masterKey");
294- /// let movie_index = client.get_or_create("movies").await.unwrap();
295- /// let accept_new_field = movie_index.get_accept_new_fields().await.unwrap();
296- /// # }
297- /// ```
298- pub async fn get_accept_new_fields ( & self ) -> Result < bool , Error > {
299- Ok ( request :: < ( ) , bool > (
300- & format ! ( "{}/indexes/{}/settings/accept-new-fields" , self . client. host, self . uid) ,
301- self . client . apikey ,
302- Method :: Get ,
303- 200 ,
304- ) . await ?)
305- }
306-
307274 /// Update [settings](../settings/struct.Settings.html) of the index.
308275 /// Updates in the settings are partial. This means that any parameters corresponding to a None value will be left unchanged.
309276 ///
@@ -318,8 +285,7 @@ impl<'a> Index<'a> {
318285 ///
319286 /// let stop_words = vec![String::from("a"), String::from("the"), String::from("of")];
320287 /// let settings = Settings::new()
321- /// .with_stop_words(stop_words.clone())
322- /// .with_accept_new_fields(false);
288+ /// .with_stop_words(stop_words.clone());
323289 ///
324290 /// let progress = movie_index.set_settings(&settings).await.unwrap();
325291 /// # }
@@ -519,30 +485,6 @@ impl<'a> Index<'a> {
519485 . into_progress ( self ) )
520486 }
521487
522- /// Update [accept-new-fields](https://docs.meilisearch.com/guides/advanced_guides/settings.html#accept-new-fields) of the index.
523- ///
524- /// # Example
525- ///
526- /// ```
527- /// # use meilisearch_sdk::{client::*, indexes::*, document::*, settings::Settings};
528- /// # #[tokio::main]
529- /// # async fn main() {
530- /// let client = Client::new("http://localhost:7700", "masterKey");
531- /// let mut movie_index = client.get_or_create("movies").await.unwrap();
532- ///
533- /// let progress = movie_index.set_accept_new_fields(false).await.unwrap();
534- /// # }
535- /// ```
536- pub async fn set_accept_new_fields ( & ' a self , accept_new_fields : bool ) -> Result < Progress < ' a > , Error > {
537- Ok ( request :: < bool , ProgressJson > (
538- & format ! ( "{}/indexes/{}/settings/accept-new-fields" , self . client. host, self . uid) ,
539- self . client . apikey ,
540- Method :: Post ( accept_new_fields) ,
541- 202 ,
542- ) . await ?
543- . into_progress ( self ) )
544- }
545-
546488 /// Reset [settings](../settings/struct.Settings.html) of the index.
547489 /// All settings will be reset to their [default value](https://docs.meilisearch.com/references/settings.html#reset-settings).
548490 ///
0 commit comments