mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Merge pull request #458 from meilisearch/rename-exactness-criterion
Rename the Exact criterion into Exactness
This commit is contained in:
commit
1df51c52e0
@ -6,10 +6,10 @@ use crate::{RawDocument, MResult};
|
|||||||
use crate::bucket_sort::BareMatch;
|
use crate::bucket_sort::BareMatch;
|
||||||
use super::{Criterion, Context, ContextMut};
|
use super::{Criterion, Context, ContextMut};
|
||||||
|
|
||||||
pub struct Exact;
|
pub struct Exactness;
|
||||||
|
|
||||||
impl Criterion for Exact {
|
impl Criterion for Exactness {
|
||||||
fn name(&self) -> &str { "exact" }
|
fn name(&self) -> &str { "exactness" }
|
||||||
|
|
||||||
fn prepare<'h, 'p, 'tag, 'txn, 'q, 'r>(
|
fn prepare<'h, 'p, 'tag, 'txn, 'q, 'r>(
|
||||||
&self,
|
&self,
|
@ -16,7 +16,7 @@ mod words;
|
|||||||
mod proximity;
|
mod proximity;
|
||||||
mod attribute;
|
mod attribute;
|
||||||
mod words_position;
|
mod words_position;
|
||||||
mod exact;
|
mod exactness;
|
||||||
mod document_id;
|
mod document_id;
|
||||||
mod sort_by_attr;
|
mod sort_by_attr;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ pub use self::words::Words;
|
|||||||
pub use self::proximity::Proximity;
|
pub use self::proximity::Proximity;
|
||||||
pub use self::attribute::Attribute;
|
pub use self::attribute::Attribute;
|
||||||
pub use self::words_position::WordsPosition;
|
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::document_id::DocumentId;
|
||||||
pub use self::sort_by_attr::SortByAttr;
|
pub use self::sort_by_attr::SortByAttr;
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ impl<'a> Default for Criteria<'a> {
|
|||||||
.add(Proximity)
|
.add(Proximity)
|
||||||
.add(Attribute)
|
.add(Attribute)
|
||||||
.add(WordsPosition)
|
.add(WordsPosition)
|
||||||
.add(Exact)
|
.add(Exactness)
|
||||||
.add(DocumentId)
|
.add(DocumentId)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ use super::{Criterion, Context};
|
|||||||
/// .add(Proximity)
|
/// .add(Proximity)
|
||||||
/// .add(Attribute)
|
/// .add(Attribute)
|
||||||
/// .add(WordsPosition)
|
/// .add(WordsPosition)
|
||||||
/// .add(Exact)
|
/// .add(Exactness)
|
||||||
/// .add(custom_ranking)
|
/// .add(custom_ranking)
|
||||||
/// .add(DocumentId);
|
/// .add(DocumentId);
|
||||||
///
|
///
|
||||||
|
@ -1064,7 +1064,7 @@ mod tests {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)"
|
"dsc(release_date)"
|
||||||
],
|
],
|
||||||
"searchableAttributes": ["name", "release_date"],
|
"searchableAttributes": ["name", "release_date"],
|
||||||
|
@ -93,7 +93,7 @@ pub enum RankingRule {
|
|||||||
Proximity,
|
Proximity,
|
||||||
Attribute,
|
Attribute,
|
||||||
WordsPosition,
|
WordsPosition,
|
||||||
Exact,
|
Exactness,
|
||||||
Asc(String),
|
Asc(String),
|
||||||
Dsc(String),
|
Dsc(String),
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ impl ToString for RankingRule {
|
|||||||
RankingRule::Proximity => "_proximity".to_string(),
|
RankingRule::Proximity => "_proximity".to_string(),
|
||||||
RankingRule::Attribute => "_attribute".to_string(),
|
RankingRule::Attribute => "_attribute".to_string(),
|
||||||
RankingRule::WordsPosition => "_words_position".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::Asc(field) => format!("asc({})", field),
|
||||||
RankingRule::Dsc(field) => format!("dsc({})", field),
|
RankingRule::Dsc(field) => format!("dsc({})", field),
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ impl FromStr for RankingRule {
|
|||||||
"_proximity" => RankingRule::Proximity,
|
"_proximity" => RankingRule::Proximity,
|
||||||
"_attribute" => RankingRule::Attribute,
|
"_attribute" => RankingRule::Attribute,
|
||||||
"_words_position" => RankingRule::WordsPosition,
|
"_words_position" => RankingRule::WordsPosition,
|
||||||
"_exact" => RankingRule::Exact,
|
"_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)) {
|
||||||
|
@ -289,7 +289,7 @@ impl<'a> SearchBuilder<'a> {
|
|||||||
RankingRule::Proximity => builder.push(Proximity),
|
RankingRule::Proximity => builder.push(Proximity),
|
||||||
RankingRule::Attribute => builder.push(Attribute),
|
RankingRule::Attribute => builder.push(Attribute),
|
||||||
RankingRule::WordsPosition => builder.push(WordsPosition),
|
RankingRule::WordsPosition => builder.push(WordsPosition),
|
||||||
RankingRule::Exact => builder.push(Exact),
|
RankingRule::Exactness => builder.push(Exactness),
|
||||||
RankingRule::Asc(field) => {
|
RankingRule::Asc(field) => {
|
||||||
match SortByAttr::lower_is_better(&ranked_map, &schema, &field) {
|
match SortByAttr::lower_is_better(&ranked_map, &schema, &field) {
|
||||||
Ok(rule) => builder.push(rule),
|
Ok(rule) => builder.push(rule),
|
||||||
|
@ -63,7 +63,7 @@ pub fn enrich_server_with_movies_settings(
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)",
|
"dsc(vote_average)",
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
|
@ -632,7 +632,7 @@ fn search_with_settings_basic() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)"
|
"dsc(vote_average)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
@ -738,7 +738,7 @@ fn search_with_settings_stop_words() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)"
|
"dsc(vote_average)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
@ -845,7 +845,7 @@ fn search_with_settings_synonyms() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)"
|
"dsc(vote_average)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
@ -957,7 +957,7 @@ fn search_with_settings_ranking_rules() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"asc(vote_average)",
|
"asc(vote_average)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(popularity)"
|
"dsc(popularity)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
@ -1064,7 +1064,7 @@ fn search_with_settings_searchable_attributes() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)"
|
"dsc(vote_average)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
@ -1170,7 +1170,7 @@ fn search_with_settings_displayed_attributes() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)"
|
"dsc(vote_average)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
@ -1241,7 +1241,7 @@ fn search_with_settings_searchable_attributes_2() {
|
|||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"dsc(popularity)",
|
"dsc(popularity)",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(vote_average)"
|
"dsc(vote_average)"
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
|
@ -46,7 +46,7 @@ fn write_all_and_delete() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
"dsc(rank)",
|
"dsc(rank)",
|
||||||
],
|
],
|
||||||
@ -174,7 +174,7 @@ fn write_all_and_update() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
"dsc(rank)",
|
"dsc(rank)",
|
||||||
],
|
],
|
||||||
@ -240,7 +240,7 @@ fn write_all_and_update() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
],
|
],
|
||||||
"searchableAttributes": [
|
"searchableAttributes": [
|
||||||
@ -293,7 +293,7 @@ fn write_all_and_update() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
],
|
],
|
||||||
"rankingDistinct": null,
|
"rankingDistinct": null,
|
||||||
|
@ -44,7 +44,7 @@ fn write_all_and_delete() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
"dsc(rank)",
|
"dsc(rank)",
|
||||||
]);
|
]);
|
||||||
@ -135,7 +135,7 @@ fn write_all_and_update() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
"dsc(rank)",
|
"dsc(rank)",
|
||||||
]);
|
]);
|
||||||
@ -172,7 +172,7 @@ fn write_all_and_update() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ fn write_all_and_update() {
|
|||||||
"_proximity",
|
"_proximity",
|
||||||
"_attribute",
|
"_attribute",
|
||||||
"_words_position",
|
"_words_position",
|
||||||
"_exact",
|
"_exactness",
|
||||||
"dsc(release_date)",
|
"dsc(release_date)",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -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:
|
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.
|
- _Typo_ - 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_ - 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.
|
- _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.
|
- _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.
|
- _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.
|
||||||
- _Exact_ - A document containing the query words in their exact form, not only a prefix of them, is considered better.
|
- _Exactness_ - A document containing the query words in their exact form, not only a prefix of them, is considered better.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user