diff --git a/src/database/config.rs b/src/database/config.rs index ef1b6ebb4..55bab6272 100644 --- a/src/database/config.rs +++ b/src/database/config.rs @@ -25,7 +25,6 @@ pub struct Config { pub access_token: Option, } - impl Config { pub(crate) fn default() -> Config { Config { @@ -36,4 +35,22 @@ impl Config { access_token: None, } } + + pub fn update_with(&mut self, new: Config) { + if let Some(stop_words) = new.stop_words { + self.stop_words = Some(stop_words); + }; + if let Some(ranking_order) = new.ranking_order { + self.ranking_order = Some(ranking_order); + }; + if let Some(distinct_field) = new.distinct_field { + self.distinct_field = Some(distinct_field); + }; + if let Some(ranking_rules) = new.ranking_rules { + self.ranking_rules = Some(ranking_rules); + }; + if let Some(access_token) = new.access_token { + self.access_token = Some(access_token); + }; + } }