mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
add exact atttributes to cli settings
This commit is contained in:
parent
6b2c2509b2
commit
bfd81ce050
@ -1,4 +1,4 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::{BTreeMap, HashSet};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdin, BufRead, BufReader, Cursor, Read, Write};
|
use std::io::{stdin, BufRead, BufReader, Cursor, Read, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -99,8 +99,10 @@ impl Settings {
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let exact_attributes = index.exact_attributes(&txn)?;
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"displayed attributes:\n\t{}\nsearchable attributes:\n\t{}\nfilterable attributes:\n\t{}\nsortable attributes:\n\t{}\ncriterion:\n\t{}\nstop words:\n\t{}\ndistinct fields:\n\t{}\nsynonyms:\n\t{}\n",
|
"displayed attributes:\n\t{}\nsearchable attributes:\n\t{}\nfilterable attributes:\n\t{}\nsortable attributes:\n\t{}\ncriterion:\n\t{}\nstop words:\n\t{}\ndistinct fields:\n\t{}\nsynonyms:\n\t{}\nexact attributes:\n{}",
|
||||||
displayed_attributes.unwrap_or(vec!["*".to_owned()]).join("\n\t"),
|
displayed_attributes.unwrap_or(vec!["*".to_owned()]).join("\n\t"),
|
||||||
searchable_attributes.unwrap_or(vec!["*".to_owned()]).join("\n\t"),
|
searchable_attributes.unwrap_or(vec!["*".to_owned()]).join("\n\t"),
|
||||||
filterable_attributes.join("\n\t"),
|
filterable_attributes.join("\n\t"),
|
||||||
@ -109,6 +111,7 @@ impl Settings {
|
|||||||
stop_words.join("\n\t"),
|
stop_words.join("\n\t"),
|
||||||
distinct_field.unwrap_or_default(),
|
distinct_field.unwrap_or_default(),
|
||||||
synonyms.into_iter().map(|(k, v)| format!("\n\t{}:\n{:?}", k, v)).collect::<String>(),
|
synonyms.into_iter().map(|(k, v)| format!("\n\t{}:\n{:?}", k, v)).collect::<String>(),
|
||||||
|
exact_attributes.join("\n\t"),
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -463,6 +466,8 @@ struct SettingsUpdate {
|
|||||||
filterable_attributes: Option<Vec<String>>,
|
filterable_attributes: Option<Vec<String>>,
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
criteria: Option<Vec<String>>,
|
criteria: Option<Vec<String>>,
|
||||||
|
#[structopt(long)]
|
||||||
|
exact_attributes: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Performer for SettingsUpdate {
|
impl Performer for SettingsUpdate {
|
||||||
@ -489,6 +494,14 @@ impl Performer for SettingsUpdate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(exact_attributes) = self.exact_attributes {
|
||||||
|
if !exact_attributes.is_empty() {
|
||||||
|
update.set_exact_attributes(exact_attributes.into_iter().collect());
|
||||||
|
} else {
|
||||||
|
update.reset_exact_attributes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut bars = Vec::new();
|
let mut bars = Vec::new();
|
||||||
let progesses = MultiProgress::new();
|
let progesses = MultiProgress::new();
|
||||||
for _ in 0..4 {
|
for _ in 0..4 {
|
||||||
|
Loading…
Reference in New Issue
Block a user