mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
reformat all the files
This commit is contained in:
parent
7086009f93
commit
5d5d115608
@ -35,15 +35,15 @@ fn base_conf(builder: &mut Settings) {
|
|||||||
const BASE_CONF: Conf = Conf {
|
const BASE_CONF: Conf = Conf {
|
||||||
dataset: "smol-songs.csv",
|
dataset: "smol-songs.csv",
|
||||||
queries: &[
|
queries: &[
|
||||||
"john ", // 9097
|
"john ", // 9097
|
||||||
"david ", // 4794
|
"david ", // 4794
|
||||||
"charles ", // 1957
|
"charles ", // 1957
|
||||||
"david bowie ", // 1200
|
"david bowie ", // 1200
|
||||||
"michael jackson ", // 600
|
"michael jackson ", // 600
|
||||||
"thelonious monk ", // 303
|
"thelonious monk ", // 303
|
||||||
"charles mingus ", // 142
|
"charles mingus ", // 142
|
||||||
"marcus miller ", // 60
|
"marcus miller ", // 60
|
||||||
"tamo ", // 13
|
"tamo ", // 13
|
||||||
"Notstandskomitee ", // 4
|
"Notstandskomitee ", // 4
|
||||||
],
|
],
|
||||||
configure: base_conf,
|
configure: base_conf,
|
||||||
@ -69,10 +69,15 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
|||||||
.map(|s| {
|
.map(|s| {
|
||||||
s.trim()
|
s.trim()
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.map(|s| format!(r#""{}""#, s)).collect::<Vec<String>>().join(" ")
|
.map(|s| format!(r#""{}""#, s))
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(" ")
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let basic_with_quote: &[&str] = &basic_with_quote.iter().map(|s| s.as_str()).collect::<Vec<&str>>();
|
let basic_with_quote: &[&str] = &basic_with_quote
|
||||||
|
.iter()
|
||||||
|
.map(|s| s.as_str())
|
||||||
|
.collect::<Vec<&str>>();
|
||||||
|
|
||||||
let confs = &[
|
let confs = &[
|
||||||
/* first we bench each criterion alone */
|
/* first we bench each criterion alone */
|
||||||
@ -113,10 +118,10 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
|||||||
group_name: "words",
|
group_name: "words",
|
||||||
queries: &[
|
queries: &[
|
||||||
"the black saint and the sinner lady and the good doggo ", // four words to pop
|
"the black saint and the sinner lady and the good doggo ", // four words to pop
|
||||||
"les liaisons dangeureuses 1793 ", // one word to pop
|
"les liaisons dangeureuses 1793 ", // one word to pop
|
||||||
"The Disneyland Children's Sing-Alone song ", // two words to pop
|
"The Disneyland Children's Sing-Alone song ", // two words to pop
|
||||||
"seven nation mummy ", // one word to pop
|
"seven nation mummy ", // one word to pop
|
||||||
"7000 Danses / Le Baiser / je me trompe de mots ", // four words to pop
|
"7000 Danses / Le Baiser / je me trompe de mots ", // four words to pop
|
||||||
"Bring Your Daughter To The Slaughter but now this is not part of the title ", // nine words to pop
|
"Bring Your Daughter To The Slaughter but now this is not part of the title ", // nine words to pop
|
||||||
"whathavenotnsuchforth and a good amount of words to pop to match the first one ", // 13
|
"whathavenotnsuchforth and a good amount of words to pop to match the first one ", // 13
|
||||||
],
|
],
|
||||||
@ -133,7 +138,6 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
|||||||
criterion: Some(&["desc(released-timestamp)"]),
|
criterion: Some(&["desc(released-timestamp)"]),
|
||||||
..BASE_CONF
|
..BASE_CONF
|
||||||
},
|
},
|
||||||
|
|
||||||
/* then we bench the asc and desc criterion on top of the default criterion */
|
/* then we bench the asc and desc criterion on top of the default criterion */
|
||||||
utils::Conf {
|
utils::Conf {
|
||||||
group_name: "asc + default",
|
group_name: "asc + default",
|
||||||
@ -145,14 +149,11 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
|||||||
criterion: Some(&desc_default[..]),
|
criterion: Some(&desc_default[..]),
|
||||||
..BASE_CONF
|
..BASE_CONF
|
||||||
},
|
},
|
||||||
|
|
||||||
/* the we bench some global / normal search with all the default criterion in the default
|
/* the we bench some global / normal search with all the default criterion in the default
|
||||||
* order */
|
* order */
|
||||||
utils::Conf {
|
utils::Conf {
|
||||||
group_name: "basic placeholder",
|
group_name: "basic placeholder",
|
||||||
queries: &[
|
queries: &[""],
|
||||||
"",
|
|
||||||
],
|
|
||||||
..BASE_CONF
|
..BASE_CONF
|
||||||
},
|
},
|
||||||
utils::Conf {
|
utils::Conf {
|
||||||
@ -173,14 +174,11 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
|||||||
group_name: "prefix search",
|
group_name: "prefix search",
|
||||||
queries: &[
|
queries: &[
|
||||||
"s", // 500k+ results
|
"s", // 500k+ results
|
||||||
"a",
|
"a", "b", "i", "x", // only 7k results
|
||||||
"b",
|
|
||||||
"i",
|
|
||||||
"x", // only 7k results
|
|
||||||
],
|
],
|
||||||
..BASE_CONF
|
..BASE_CONF
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
utils::run_benches(c, confs);
|
utils::run_benches(c, confs);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
use std::{fs::{File, create_dir_all, remove_dir_all}, time::Duration};
|
use std::{
|
||||||
|
fs::{create_dir_all, remove_dir_all, File},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
|
|
||||||
use heed::EnvOpenOptions;
|
|
||||||
use criterion::BenchmarkId;
|
use criterion::BenchmarkId;
|
||||||
use milli::{FacetCondition, Index, update::{IndexDocumentsMethod, Settings, UpdateBuilder, UpdateFormat}};
|
use heed::EnvOpenOptions;
|
||||||
|
use milli::{
|
||||||
|
update::{IndexDocumentsMethod, Settings, UpdateBuilder, UpdateFormat},
|
||||||
|
FacetCondition, Index,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct Conf<'a> {
|
pub struct Conf<'a> {
|
||||||
/// where we are going to create our database.mmdb directory
|
/// where we are going to create our database.mmdb directory
|
||||||
@ -11,7 +17,7 @@ pub struct Conf<'a> {
|
|||||||
/// the dataset to be used, it must be an uncompressed csv
|
/// the dataset to be used, it must be an uncompressed csv
|
||||||
pub dataset: &'a str,
|
pub dataset: &'a str,
|
||||||
pub group_name: &'a str,
|
pub group_name: &'a str,
|
||||||
pub queries: &'a[&'a str],
|
pub queries: &'a [&'a str],
|
||||||
/// here you can change which criterion are used and in which order.
|
/// here you can change which criterion are used and in which order.
|
||||||
/// - if you specify something all the base configuration will be thrown out
|
/// - if you specify something all the base configuration will be thrown out
|
||||||
/// - if you don't specify anything (None) the default configuration will be kept
|
/// - if you don't specify anything (None) the default configuration will be kept
|
||||||
@ -36,7 +42,6 @@ impl Conf<'_> {
|
|||||||
facet_condition: None,
|
facet_condition: None,
|
||||||
optional_words: true,
|
optional_words: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn base_setup(conf: &Conf) -> Index {
|
pub fn base_setup(conf: &Conf) -> Index {
|
||||||
@ -77,7 +82,8 @@ pub fn base_setup(conf: &Conf) -> Index {
|
|||||||
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 dataset_path = format!("benches/{}", conf.dataset);
|
let dataset_path = format!("benches/{}", conf.dataset);
|
||||||
let reader = File::open(&dataset_path).expect(&format!("could not find the dataset in: {}", &dataset_path));
|
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();
|
||||||
|
|
||||||
|
@ -38,10 +38,15 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
|||||||
.map(|s| {
|
.map(|s| {
|
||||||
s.trim()
|
s.trim()
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.map(|s| format!(r#""{}""#, s)).collect::<Vec<String>>().join(" ")
|
.map(|s| format!(r#""{}""#, s))
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(" ")
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let basic_with_quote: &[&str] = &basic_with_quote.iter().map(|s| s.as_str()).collect::<Vec<&str>>();
|
let basic_with_quote: &[&str] = &basic_with_quote
|
||||||
|
.iter()
|
||||||
|
.map(|s| s.as_str())
|
||||||
|
.collect::<Vec<&str>>();
|
||||||
|
|
||||||
let confs = &[
|
let confs = &[
|
||||||
/* first we bench each criterion alone */
|
/* first we bench each criterion alone */
|
||||||
|
Loading…
Reference in New Issue
Block a user