mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
rename criterions on settings route; fix #480
This commit is contained in:
parent
3c74e71d4f
commit
bb5d931f16
@ -105,12 +105,12 @@ pub enum RankingRule {
|
|||||||
impl std::fmt::Display for RankingRule {
|
impl std::fmt::Display for RankingRule {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
RankingRule::Typo => write!(f, "_typo"),
|
RankingRule::Typo => write!(f, "typo"),
|
||||||
RankingRule::Words => write!(f, "_words"),
|
RankingRule::Words => write!(f, "words"),
|
||||||
RankingRule::Proximity => write!(f, "_proximity"),
|
RankingRule::Proximity => write!(f, "proximity"),
|
||||||
RankingRule::Attribute => write!(f, "_attribute"),
|
RankingRule::Attribute => write!(f, "attribute"),
|
||||||
RankingRule::WordsPosition => write!(f, "_words_position"),
|
RankingRule::WordsPosition => write!(f, "words_position"),
|
||||||
RankingRule::Exactness => write!(f, "_exactness"),
|
RankingRule::Exactness => write!(f, "exactness"),
|
||||||
RankingRule::Asc(field) => write!(f, "asc({})", field),
|
RankingRule::Asc(field) => write!(f, "asc({})", field),
|
||||||
RankingRule::Dsc(field) => write!(f, "dsc({})", field),
|
RankingRule::Dsc(field) => write!(f, "dsc({})", field),
|
||||||
}
|
}
|
||||||
@ -122,12 +122,12 @@ impl FromStr for RankingRule {
|
|||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
let rule = match s {
|
let rule = match s {
|
||||||
"_typo" => RankingRule::Typo,
|
"typo" => RankingRule::Typo,
|
||||||
"_words" => RankingRule::Words,
|
"words" => RankingRule::Words,
|
||||||
"_proximity" => RankingRule::Proximity,
|
"proximity" => RankingRule::Proximity,
|
||||||
"_attribute" => RankingRule::Attribute,
|
"attribute" => RankingRule::Attribute,
|
||||||
"_words_position" => RankingRule::WordsPosition,
|
"words_position" => RankingRule::WordsPosition,
|
||||||
"_exactness" => RankingRule::Exactness,
|
"exactness" => RankingRule::Exactness,
|
||||||
_ => {
|
_ => {
|
||||||
let captures = RANKING_RULE_REGEX.captures(s).ok_or(RankingRuleConversionError)?;
|
let captures = RANKING_RULE_REGEX.captures(s).ok_or(RankingRuleConversionError)?;
|
||||||
match (captures.get(1).map(|m| m.as_str()), captures.get(2)) {
|
match (captures.get(1).map(|m| m.as_str()), captures.get(2)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user