mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
Merge #344
344: Move the sort ranking rule before the exactness ranking rule r=ManyTheFish a=Kerollmops This PR moves the sort ranking rule at the 5th position by default, right before the exactness one. Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
commit
48d211b8b0
@ -12,14 +12,14 @@ pub enum Criterion {
|
|||||||
Words,
|
Words,
|
||||||
/// Sorted by increasing number of typos.
|
/// Sorted by increasing number of typos.
|
||||||
Typo,
|
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.
|
/// Sorted by increasing distance between matched query terms.
|
||||||
Proximity,
|
Proximity,
|
||||||
/// Documents with quey words contained in more important
|
/// Documents with quey words contained in more important
|
||||||
/// attributes are considered better.
|
/// attributes are considered better.
|
||||||
Attribute,
|
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.
|
/// Sorted by the similarity of the matched words with the query words.
|
||||||
Exactness,
|
Exactness,
|
||||||
/// Sorted by the increasing value of the field specified.
|
/// Sorted by the increasing value of the field specified.
|
||||||
@ -45,9 +45,9 @@ impl FromStr for Criterion {
|
|||||||
match text {
|
match text {
|
||||||
"words" => Ok(Criterion::Words),
|
"words" => Ok(Criterion::Words),
|
||||||
"typo" => Ok(Criterion::Typo),
|
"typo" => Ok(Criterion::Typo),
|
||||||
"sort" => Ok(Criterion::Sort),
|
|
||||||
"proximity" => Ok(Criterion::Proximity),
|
"proximity" => Ok(Criterion::Proximity),
|
||||||
"attribute" => Ok(Criterion::Attribute),
|
"attribute" => Ok(Criterion::Attribute),
|
||||||
|
"sort" => Ok(Criterion::Sort),
|
||||||
"exactness" => Ok(Criterion::Exactness),
|
"exactness" => Ok(Criterion::Exactness),
|
||||||
text => match AscDesc::from_str(text) {
|
text => match AscDesc::from_str(text) {
|
||||||
Ok(AscDesc::Asc(field)) => Ok(Criterion::Asc(field)),
|
Ok(AscDesc::Asc(field)) => Ok(Criterion::Asc(field)),
|
||||||
@ -89,9 +89,9 @@ pub fn default_criteria() -> Vec<Criterion> {
|
|||||||
vec![
|
vec![
|
||||||
Criterion::Words,
|
Criterion::Words,
|
||||||
Criterion::Typo,
|
Criterion::Typo,
|
||||||
Criterion::Sort,
|
|
||||||
Criterion::Proximity,
|
Criterion::Proximity,
|
||||||
Criterion::Attribute,
|
Criterion::Attribute,
|
||||||
|
Criterion::Sort,
|
||||||
Criterion::Exactness,
|
Criterion::Exactness,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -103,9 +103,9 @@ impl fmt::Display for Criterion {
|
|||||||
match self {
|
match self {
|
||||||
Words => f.write_str("words"),
|
Words => f.write_str("words"),
|
||||||
Typo => f.write_str("typo"),
|
Typo => f.write_str("typo"),
|
||||||
Sort => f.write_str("sort"),
|
|
||||||
Proximity => f.write_str("proximity"),
|
Proximity => f.write_str("proximity"),
|
||||||
Attribute => f.write_str("attribute"),
|
Attribute => f.write_str("attribute"),
|
||||||
|
Sort => f.write_str("sort"),
|
||||||
Exactness => f.write_str("exactness"),
|
Exactness => f.write_str("exactness"),
|
||||||
Asc(attr) => write!(f, "{}:asc", attr),
|
Asc(attr) => write!(f, "{}:asc", attr),
|
||||||
Desc(attr) => write!(f, "{}:desc", attr),
|
Desc(attr) => write!(f, "{}:desc", attr),
|
||||||
|
Loading…
Reference in New Issue
Block a user