mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-19 01:18:31 +08:00
implement display for criterion
Update milli/src/criterion.rs Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
parent
71b069d3e1
commit
9e1eb25232
@ -1,4 +1,5 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
use anyhow::{Context, bail};
|
use anyhow::{Context, bail};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
@ -63,3 +64,20 @@ pub fn default_criteria() -> Vec<Criterion> {
|
|||||||
Criterion::Exactness,
|
Criterion::Exactness,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Criterion {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
use Criterion::*;
|
||||||
|
|
||||||
|
match self {
|
||||||
|
Typo => f.write_str("typo"),
|
||||||
|
Words => f.write_str("words"),
|
||||||
|
Proximity => f.write_str("proximity"),
|
||||||
|
Attribute => f.write_str("attribute"),
|
||||||
|
WordsPosition => f.write_str("wordsPosition"),
|
||||||
|
Exactness => f.write_str("exactness"),
|
||||||
|
Asc(attr) => write!(f, "asc({:?})", attr),
|
||||||
|
Desc(attr) => write!(f, "desc({:?})", attr),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user