mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-11 22:14:32 +01:00
fix the benches
This commit is contained in:
parent
4b78ef31b6
commit
136efd6b53
@ -18,8 +18,8 @@ fn bench_criterion(c: &mut criterion::Criterion) {
|
|||||||
];
|
];
|
||||||
let default_criterion: Vec<String> = milli::default_criteria().iter().map(|criteria| criteria.to_string()).collect();
|
let default_criterion: Vec<String> = milli::default_criteria().iter().map(|criteria| criteria.to_string()).collect();
|
||||||
let default_criterion = default_criterion.iter().map(|s| s.as_str());
|
let default_criterion = default_criterion.iter().map(|s| s.as_str());
|
||||||
let asc_default: Vec<&str> = std::iter::once("asc").chain(default_criterion.clone()).collect();
|
let asc_default: Vec<&str> = std::iter::once("asc(released-timestamp)").chain(default_criterion.clone()).collect();
|
||||||
let desc_default: Vec<&str> = std::iter::once("desc").chain(default_criterion.clone()).collect();
|
let desc_default: Vec<&str> = std::iter::once("desc(released-timestamp)").chain(default_criterion.clone()).collect();
|
||||||
|
|
||||||
let confs = &[
|
let confs = &[
|
||||||
utils::Conf {
|
utils::Conf {
|
||||||
@ -72,13 +72,13 @@ fn bench_criterion(c: &mut criterion::Criterion) {
|
|||||||
utils::Conf {
|
utils::Conf {
|
||||||
group_name: "asc",
|
group_name: "asc",
|
||||||
queries: songs_base_queries,
|
queries: songs_base_queries,
|
||||||
criterion: Some(&["asc"]),
|
criterion: Some(&["asc(released-timestamp)"]),
|
||||||
..utils::Conf::BASE_SONGS
|
..utils::Conf::BASE_SONGS
|
||||||
},
|
},
|
||||||
utils::Conf {
|
utils::Conf {
|
||||||
group_name: "desc",
|
group_name: "desc",
|
||||||
queries: songs_base_queries,
|
queries: songs_base_queries,
|
||||||
criterion: Some(&["desc"]),
|
criterion: Some(&["desc(released-timestamp)"]),
|
||||||
..utils::Conf::BASE_SONGS
|
..utils::Conf::BASE_SONGS
|
||||||
},
|
},
|
||||||
utils::Conf {
|
utils::Conf {
|
||||||
|
@ -40,6 +40,18 @@ impl Conf<'_> {
|
|||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
.collect();
|
.collect();
|
||||||
builder.set_searchable_fields(searchable_fields);
|
builder.set_searchable_fields(searchable_fields);
|
||||||
|
|
||||||
|
let faceted_fields = [
|
||||||
|
("released-timestamp", "integer"),
|
||||||
|
("duration-float", "float"),
|
||||||
|
("genre", "string"),
|
||||||
|
("country", "string"),
|
||||||
|
("artist", "string"),
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.map(|(a, b)| (a.to_string(), b.to_string()))
|
||||||
|
.collect();
|
||||||
|
builder.set_faceted_fields(faceted_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const BASE: Self = Conf {
|
pub const BASE: Self = Conf {
|
||||||
@ -54,7 +66,7 @@ impl Conf<'_> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const BASE_SONGS: Self = Conf {
|
pub const BASE_SONGS: Self = Conf {
|
||||||
dataset: "smol-songs",
|
dataset: "smol-songs.csv",
|
||||||
configure: Self::songs_conf,
|
configure: Self::songs_conf,
|
||||||
..Self::BASE
|
..Self::BASE
|
||||||
};
|
};
|
||||||
@ -97,7 +109,8 @@ pub fn base_setup(conf: &Conf) -> Index {
|
|||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.index_documents_method(IndexDocumentsMethod::ReplaceDocuments);
|
builder.index_documents_method(IndexDocumentsMethod::ReplaceDocuments);
|
||||||
// we called from cargo the current directory is supposed to be milli/milli
|
// we called from cargo the current directory is supposed to be milli/milli
|
||||||
let reader = File::open(conf.dataset).unwrap();
|
let dataset_path = format!("benches/{}", conf.dataset);
|
||||||
|
let reader = File::open(&dataset_path).expect(&format!("could not find the dataset in: {}", &dataset_path));
|
||||||
builder.execute(reader, |_, _| ()).unwrap();
|
builder.execute(reader, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user