Merge pull request #309 from bidoubiwa/remove_stop_words_from_settings

Removed stop words from settings route
This commit is contained in:
Clément Renault 2019-11-19 18:35:27 +01:00 committed by GitHub
commit e554784527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
use std::collections::{HashMap, HashSet};
use std::collections::HashMap;
use http::StatusCode;
use serde::{Deserialize, Serialize};
@ -14,7 +14,6 @@ use crate::Data;
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct SettingBody {
pub stop_words: Option<StopWords>,
pub ranking_order: Option<RankingOrder>,
pub distinct_field: Option<DistinctField>,
pub ranking_rules: Option<RankingRules>,
@ -27,7 +26,6 @@ pub enum RankingOrdering {
Dsc,
}
pub type StopWords = HashSet<String>;
pub type RankingOrder = Vec<String>;
pub type DistinctField = String;
pub type RankingRules = HashMap<String, RankingOrdering>;
@ -62,10 +60,6 @@ pub async fn update(mut ctx: Context<Data>) -> SResult<Response> {
None => SettingBody::default(),
};
if let Some(stop_words) = settings.stop_words {
current_settings.stop_words = Some(stop_words);
}
if let Some(ranking_order) = settings.ranking_order {
current_settings.ranking_order = Some(ranking_order);
}