From e2cefc9b4f760eba09327d2bcdcab377f9e5e51d Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 7 Sep 2021 16:11:44 +0200 Subject: [PATCH] Move the sort ranking rule before the exactness ranking rule --- milli/src/criterion.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/milli/src/criterion.rs b/milli/src/criterion.rs index 47eb7c7dc..209a71b0d 100644 --- a/milli/src/criterion.rs +++ b/milli/src/criterion.rs @@ -12,14 +12,14 @@ pub enum Criterion { Words, /// Sorted by increasing number of typos. Typo, - /// Dynamically sort at query time the documents. None, one or multiple Asc/Desc sortable - /// attributes can be used in place of this criterion at query time. - Sort, /// Sorted by increasing distance between matched query terms. Proximity, /// Documents with quey words contained in more important /// attributes are considered better. Attribute, + /// Dynamically sort at query time the documents. None, one or multiple Asc/Desc sortable + /// attributes can be used in place of this criterion at query time. + Sort, /// Sorted by the similarity of the matched words with the query words. Exactness, /// Sorted by the increasing value of the field specified. @@ -45,9 +45,9 @@ impl FromStr for Criterion { match text { "words" => Ok(Criterion::Words), "typo" => Ok(Criterion::Typo), - "sort" => Ok(Criterion::Sort), "proximity" => Ok(Criterion::Proximity), "attribute" => Ok(Criterion::Attribute), + "sort" => Ok(Criterion::Sort), "exactness" => Ok(Criterion::Exactness), text => match AscDesc::from_str(text) { Ok(AscDesc::Asc(field)) => Ok(Criterion::Asc(field)), @@ -89,9 +89,9 @@ pub fn default_criteria() -> Vec { vec![ Criterion::Words, Criterion::Typo, - Criterion::Sort, Criterion::Proximity, Criterion::Attribute, + Criterion::Sort, Criterion::Exactness, ] } @@ -103,9 +103,9 @@ impl fmt::Display for Criterion { match self { Words => f.write_str("words"), Typo => f.write_str("typo"), - Sort => f.write_str("sort"), Proximity => f.write_str("proximity"), Attribute => f.write_str("attribute"), + Sort => f.write_str("sort"), Exactness => f.write_str("exactness"), Asc(attr) => write!(f, "{}:asc", attr), Desc(attr) => write!(f, "{}:desc", attr),