mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Merge #210
210: Check the benchmarks in the CI r=Kerollmops a=Kerollmops Fixes #209. Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
commit
fd598f060c
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@ -29,6 +29,11 @@ jobs:
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --all
|
||||
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
@ -37,6 +42,11 @@ jobs:
|
||||
with:
|
||||
command: test
|
||||
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: bench
|
||||
args: --no-run -p benchmarks
|
||||
|
||||
# - uses: actions-rs/cargo@v1
|
||||
# with:
|
||||
# command: bench
|
||||
|
@ -30,7 +30,7 @@ fn base_conf(builder: &mut Settings) {
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
builder.set_faceted_fields(faceted_fields);
|
||||
builder.set_filterable_fields(faceted_fields);
|
||||
}
|
||||
|
||||
const BASE_CONF: Conf = Conf {
|
||||
@ -156,17 +156,17 @@ fn bench_songs(c: &mut criterion::Criterion) {
|
||||
/* we bench the filters with the default request */
|
||||
utils::Conf {
|
||||
group_name: "basic filter: <=",
|
||||
facet_condition: Some("released-timestamp <= 946728000"), // year 2000
|
||||
filter: Some("released-timestamp <= 946728000"), // year 2000
|
||||
..BASE_CONF
|
||||
},
|
||||
utils::Conf {
|
||||
group_name: "basic filter: TO",
|
||||
facet_condition: Some("released-timestamp 946728000 TO 1262347200"), // year 2000 to 2010
|
||||
filter: Some("released-timestamp 946728000 TO 1262347200"), // year 2000 to 2010
|
||||
..BASE_CONF
|
||||
},
|
||||
utils::Conf {
|
||||
group_name: "big filter",
|
||||
facet_condition: Some("released-timestamp != 1262347200 AND (NOT (released-timestamp = 946728000)) AND (duration-float = 1 OR (duration-float 1.1 TO 1.5 AND released-timestamp > 315576000))"),
|
||||
filter: Some("released-timestamp != 1262347200 AND (NOT (released-timestamp = 946728000)) AND (duration-float = 1 OR (duration-float 1.1 TO 1.5 AND released-timestamp > 315576000))"),
|
||||
..BASE_CONF
|
||||
},
|
||||
|
||||
|
@ -4,7 +4,7 @@ use criterion::BenchmarkId;
|
||||
use heed::EnvOpenOptions;
|
||||
use milli::{
|
||||
update::{IndexDocumentsMethod, Settings, UpdateBuilder, UpdateFormat},
|
||||
FacetCondition, Index,
|
||||
FilterCondition, Index,
|
||||
};
|
||||
|
||||
pub struct Conf<'a> {
|
||||
@ -21,7 +21,7 @@ pub struct Conf<'a> {
|
||||
pub criterion: Option<&'a [&'a str]>,
|
||||
/// the last chance to configure your database as you want
|
||||
pub configure: fn(&mut Settings),
|
||||
pub facet_condition: Option<&'a str>,
|
||||
pub filter: Option<&'a str>,
|
||||
/// enable or disable the optional words on the query
|
||||
pub optional_words: bool,
|
||||
/// primary key, if there is None we'll auto-generate docids for every documents
|
||||
@ -36,7 +36,7 @@ impl Conf<'_> {
|
||||
queries: &[],
|
||||
criterion: None,
|
||||
configure: |_| (),
|
||||
facet_condition: None,
|
||||
filter: None,
|
||||
optional_words: true,
|
||||
primary_key: None,
|
||||
};
|
||||
@ -64,7 +64,7 @@ pub fn base_setup(conf: &Conf) -> Index {
|
||||
let mut builder = update_builder.settings(&mut wtxn, &index);
|
||||
|
||||
if let Some(criterion) = conf.criterion {
|
||||
builder.reset_faceted_fields();
|
||||
builder.reset_filterable_fields();
|
||||
builder.reset_criteria();
|
||||
builder.reset_stop_words();
|
||||
|
||||
@ -105,10 +105,10 @@ pub fn run_benches(c: &mut criterion::Criterion, confs: &[Conf]) {
|
||||
let rtxn = index.read_txn().unwrap();
|
||||
let mut search = index.search(&rtxn);
|
||||
search.query(query).optional_words(conf.optional_words);
|
||||
if let Some(facet_condition) = conf.facet_condition {
|
||||
let facet_condition =
|
||||
FacetCondition::from_str(&rtxn, &index, facet_condition).unwrap();
|
||||
search.facet_condition(facet_condition);
|
||||
if let Some(filter) = conf.filter {
|
||||
let filter =
|
||||
FilterCondition::from_str(&rtxn, &index, filter).unwrap();
|
||||
search.filter(filter);
|
||||
}
|
||||
let _ids = search.execute().unwrap();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user