set new attributes indexed if needed

This commit is contained in:
Quentin de Quelen 2020-01-27 08:52:36 +01:00 committed by qdequele
parent b1528f9466
commit 585bba43a0
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
10 changed files with 100 additions and 648 deletions

View file

@ -57,6 +57,7 @@ pub async fn get_all(ctx: Request<Data>) -> SResult<Response> {
let attribute_identifier = schema.clone().map(|s| s.identifier());
let attributes_searchable = schema.clone().map(|s| s.get_indexed_name());
let attributes_displayed = schema.clone().map(|s| s.get_displayed_name());
let index_new_fields = schema.map(|s| s.must_index_new_fields());
let settings = Settings {
ranking_rules,
@ -66,6 +67,7 @@ pub async fn get_all(ctx: Request<Data>) -> SResult<Response> {
attributes_displayed,
stop_words,
synonyms,
index_new_fields,
};
Ok(tide::Response::new(200).body_json(&settings).unwrap())
@ -99,6 +101,7 @@ pub async fn delete_all(ctx: Request<Data>) -> SResult<Response> {
attributes_displayed: UpdateState::Clear,
stop_words: UpdateState::Clear,
synonyms: UpdateState::Clear,
index_new_fields: UpdateState::Clear,
};
let update_id = index.settings_update(&mut writer, settings)?;