From 9d167c08f48e6d1bd8a807c0716874d08c3b012e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 31 Jan 2020 11:45:57 +0100 Subject: [PATCH] Rename the Exact criterion into Exactness --- .../src/criterion/{exact.rs => exactness.rs} | 6 +++--- meilisearch-core/src/criterion/mod.rs | 6 +++--- meilisearch-core/src/criterion/sort_by_attr.rs | 2 +- meilisearch-core/src/settings.rs | 6 +++--- meilisearch-http/src/helpers/meilisearch.rs | 2 +- typos-ranking-rules.md | 10 +++++----- 6 files changed, 16 insertions(+), 16 deletions(-) rename meilisearch-core/src/criterion/{exact.rs => exactness.rs} (96%) diff --git a/meilisearch-core/src/criterion/exact.rs b/meilisearch-core/src/criterion/exactness.rs similarity index 96% rename from meilisearch-core/src/criterion/exact.rs rename to meilisearch-core/src/criterion/exactness.rs index b221498ac..9b2d7c188 100644 --- a/meilisearch-core/src/criterion/exact.rs +++ b/meilisearch-core/src/criterion/exactness.rs @@ -6,10 +6,10 @@ use crate::{RawDocument, MResult}; use crate::bucket_sort::BareMatch; use super::{Criterion, Context, ContextMut}; -pub struct Exact; +pub struct Exactness; -impl Criterion for Exact { - fn name(&self) -> &str { "exact" } +impl Criterion for Exactness { + fn name(&self) -> &str { "exactness" } fn prepare<'h, 'p, 'tag, 'txn, 'q, 'r>( &self, diff --git a/meilisearch-core/src/criterion/mod.rs b/meilisearch-core/src/criterion/mod.rs index 971875e76..d5c291618 100644 --- a/meilisearch-core/src/criterion/mod.rs +++ b/meilisearch-core/src/criterion/mod.rs @@ -16,7 +16,7 @@ mod words; mod proximity; mod attribute; mod words_position; -mod exact; +mod exactness; mod document_id; mod sort_by_attr; @@ -25,7 +25,7 @@ pub use self::words::Words; pub use self::proximity::Proximity; pub use self::attribute::Attribute; pub use self::words_position::WordsPosition; -pub use self::exact::Exact; +pub use self::exactness::Exactness; pub use self::document_id::DocumentId; pub use self::sort_by_attr::SortByAttr; @@ -124,7 +124,7 @@ impl<'a> Default for Criteria<'a> { .add(Proximity) .add(Attribute) .add(WordsPosition) - .add(Exact) + .add(Exactness) .add(DocumentId) .build() } diff --git a/meilisearch-core/src/criterion/sort_by_attr.rs b/meilisearch-core/src/criterion/sort_by_attr.rs index 621acca7a..453aba655 100644 --- a/meilisearch-core/src/criterion/sort_by_attr.rs +++ b/meilisearch-core/src/criterion/sort_by_attr.rs @@ -32,7 +32,7 @@ use super::{Criterion, Context}; /// .add(Proximity) /// .add(Attribute) /// .add(WordsPosition) -/// .add(Exact) +/// .add(Exactness) /// .add(custom_ranking) /// .add(DocumentId); /// diff --git a/meilisearch-core/src/settings.rs b/meilisearch-core/src/settings.rs index e895a5eee..01790bd8a 100644 --- a/meilisearch-core/src/settings.rs +++ b/meilisearch-core/src/settings.rs @@ -93,7 +93,7 @@ pub enum RankingRule { Proximity, Attribute, WordsPosition, - Exact, + Exactness, Asc(String), Dsc(String), } @@ -106,7 +106,7 @@ impl ToString for RankingRule { RankingRule::Proximity => "_proximity".to_string(), RankingRule::Attribute => "_attribute".to_string(), RankingRule::WordsPosition => "_words_position".to_string(), - RankingRule::Exact => "_exact".to_string(), + RankingRule::Exactness => "_exactness".to_string(), RankingRule::Asc(field) => format!("asc({})", field), RankingRule::Dsc(field) => format!("dsc({})", field), } @@ -123,7 +123,7 @@ impl FromStr for RankingRule { "_proximity" => RankingRule::Proximity, "_attribute" => RankingRule::Attribute, "_words_position" => RankingRule::WordsPosition, - "_exact" => RankingRule::Exact, + "_exactness" => RankingRule::Exactness, _ => { let captures = RANKING_RULE_REGEX.captures(s).ok_or(RankingRuleConversionError)?; match (captures.get(1).map(|m| m.as_str()), captures.get(2)) { diff --git a/meilisearch-http/src/helpers/meilisearch.rs b/meilisearch-http/src/helpers/meilisearch.rs index afdfa521e..6e15dcf0b 100644 --- a/meilisearch-http/src/helpers/meilisearch.rs +++ b/meilisearch-http/src/helpers/meilisearch.rs @@ -289,7 +289,7 @@ impl<'a> SearchBuilder<'a> { RankingRule::Proximity => builder.push(Proximity), RankingRule::Attribute => builder.push(Attribute), RankingRule::WordsPosition => builder.push(WordsPosition), - RankingRule::Exact => builder.push(Exact), + RankingRule::Exactness => builder.push(Exactness), RankingRule::Asc(field) => { match SortByAttr::lower_is_better(&ranked_map, &schema, &field) { Ok(rule) => builder.push(rule), diff --git a/typos-ranking-rules.md b/typos-ranking-rules.md index 0b2179a43..4cd72d089 100644 --- a/typos-ranking-rules.md +++ b/typos-ranking-rules.md @@ -50,10 +50,10 @@ What is a bucket sort? We sort all the documents with the first rule, for all do Here is the list of all the default rules that are executed in this specific order by default: -- _Number of Typos_ - The less typos there are beween the query words and the document words, the better is the document. -- _Number of Words_ - A document containing more of the query words will be more important than one that contains less. -- _Words Proximity_ - The closer the query words are in the document the better is the document. +- _Typo_ - The less typos there are beween the query words and the document words, the better is the document. +- _Words_ - A document containing more of the query words will be more important than one that contains less. +- _Proximity_ - The closer the query words are in the document the better is the document. - _Attribute_ - A document containing the query words in a more important attribute than another document is considered better. -- _Position_ - A document containing the query words at the start of an attribute is considered better than a document that contains them at the end. -- _Exact_ - A document containing the query words in their exact form, not only a prefix of them, is considered better. +- _Words Position_ - A document containing the query words at the start of an attribute is considered better than a document that contains them at the end. +- _Exactness_ - A document containing the query words in their exact form, not only a prefix of them, is considered better.