Skip to content

Commit 44ac655

Browse files
authored
Remove acceptNewFields (#42)
* Remove acceptNewFields routes * Update README
1 parent fb4110b commit 44ac655

File tree

4 files changed

+4
-64
lines changed

4 files changed

+4
-64
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ About this automation:
8282

8383
Make a PR modifying the file [`Cargo.toml`](/Cargo.toml) with the right version.
8484

85-
```ruby
85+
```toml
8686
version = "X.X.X"
8787
```
8888

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ Output:
124124
## 🤖 Compatibility with MeiliSearch
125125

126126
This package is compatible with the following MeiliSearch versions:
127-
- `v0.12.X`
128-
- `v0.11.X`
127+
- `v0.13.0`
129128

130129
## 🌐 Running in the Browser with WASM
131130

src/progress.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ pub struct SettingsUpdate {
9090
pub displayed_attributes: UpdateState<HashSet<String>>,
9191
pub stop_words: UpdateState<BTreeSet<String>>,
9292
pub synonyms: UpdateState<BTreeMap<String, Vec<String>>>,
93-
pub accept_new_fields: UpdateState<bool>,
9493
}
9594

9695
#[derive(Debug, Clone, Deserialize)]

src/settings.rs

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -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

126113
impl<'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

Comments
 (0)