add the criterion attribute when importing dumps from the v1

This commit is contained in:
tamo 2021-05-11 13:21:36 +02:00
parent 9e798fea75
commit c30b32e173
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -45,7 +45,7 @@ impl From<Settings> for index_controller::Settings<Unchecked> {
// we need to convert the old `Vec<String>` into a `BTreeSet<String>` // we need to convert the old `Vec<String>` into a `BTreeSet<String>`
ranking_rules: settings.ranking_rules.map(|o| o.map(|vec| vec.into_iter().filter_map(|criterion| { ranking_rules: settings.ranking_rules.map(|o| o.map(|vec| vec.into_iter().filter_map(|criterion| {
match criterion.as_str() { match criterion.as_str() {
"words" | "typo" | "proximity" => Some(criterion), "words" | "typo" | "proximity" | "attribute" => Some(criterion),
s if s.starts_with("asc") || s.starts_with("desc") => Some(criterion), s if s.starts_with("asc") || s.starts_with("desc") => Some(criterion),
"wordsPosition" => { "wordsPosition" => {
warn!("The criteria `words` and `wordsPosition` have been merged into a single criterion `words` so `wordsPositon` will be ignored"); warn!("The criteria `words` and `wordsPosition` have been merged into a single criterion `words` so `wordsPositon` will be ignored");