mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
rename min word len for typo error
This commit is contained in:
parent
286dd7b2e4
commit
4c4b336ecb
@ -72,7 +72,7 @@ pub enum UserError {
|
|||||||
SerdeJson(serde_json::Error),
|
SerdeJson(serde_json::Error),
|
||||||
SortError(SortError),
|
SortError(SortError),
|
||||||
UnknownInternalDocumentId { document_id: DocumentId },
|
UnknownInternalDocumentId { document_id: DocumentId },
|
||||||
InvalidMinTypoWordSetting(u8, u8),
|
InvalidMinTypoWordLenSetting(u8, u8),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<io::Error> for Error {
|
impl From<io::Error> for Error {
|
||||||
@ -292,7 +292,7 @@ ranking rules settings to use the sort parameter at search time.",
|
|||||||
Self::UnknownInternalDocumentId { document_id } => {
|
Self::UnknownInternalDocumentId { document_id } => {
|
||||||
write!(f, "An unknown internal document id have been used: `{}`.", document_id)
|
write!(f, "An unknown internal document id have been used: `{}`.", document_id)
|
||||||
}
|
}
|
||||||
Self::InvalidMinTypoWordSetting(one, two) => write!(f, "`minWordSizeForTypos` setting is invalid. `oneTypo` and `twoTypos` fields should be between `0` and `255`, and `twoTypos` should be greater or equals to `oneTypo` but found `oneTypo: {}` and twoTypos: {}`.", one, two),
|
Self::InvalidMinTypoWordLenSetting(one, two) => write!(f, "`minWordSizeForTypos` setting is invalid. `oneTypo` and `twoTypos` fields should be between `0` and `255`, and `twoTypos` should be greater or equals to `oneTypo` but found `oneTypo: {}` and twoTypos: {}`.", one, two),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> {
|
|||||||
match (&self.min_1_typo_word_len, &self.min_2_typos_word_len) {
|
match (&self.min_1_typo_word_len, &self.min_2_typos_word_len) {
|
||||||
(Setting::Set(one), Setting::Set(two)) => {
|
(Setting::Set(one), Setting::Set(two)) => {
|
||||||
if one > two {
|
if one > two {
|
||||||
return Err(UserError::InvalidMinTypoWordSetting(*one, *two).into());
|
return Err(UserError::InvalidMinTypoWordLenSetting(*one, *two).into());
|
||||||
} else {
|
} else {
|
||||||
self.index.put_min_word_len_1_typo(&mut self.wtxn, *one)?;
|
self.index.put_min_word_len_1_typo(&mut self.wtxn, *one)?;
|
||||||
self.index.put_min_word_len_2_typos(&mut self.wtxn, *two)?;
|
self.index.put_min_word_len_2_typos(&mut self.wtxn, *two)?;
|
||||||
@ -507,7 +507,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> {
|
|||||||
(Setting::Set(one), _) => {
|
(Setting::Set(one), _) => {
|
||||||
let two = self.index.min_word_len_2_typos(&self.wtxn)?;
|
let two = self.index.min_word_len_2_typos(&self.wtxn)?;
|
||||||
if *one > two {
|
if *one > two {
|
||||||
return Err(UserError::InvalidMinTypoWordSetting(*one, two).into());
|
return Err(UserError::InvalidMinTypoWordLenSetting(*one, two).into());
|
||||||
} else {
|
} else {
|
||||||
self.index.put_min_word_len_1_typo(&mut self.wtxn, *one)?;
|
self.index.put_min_word_len_1_typo(&mut self.wtxn, *one)?;
|
||||||
}
|
}
|
||||||
@ -515,7 +515,7 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> {
|
|||||||
(_, Setting::Set(two)) => {
|
(_, Setting::Set(two)) => {
|
||||||
let one = self.index.min_word_len_1_typo(&self.wtxn)?;
|
let one = self.index.min_word_len_1_typo(&self.wtxn)?;
|
||||||
if one > *two {
|
if one > *two {
|
||||||
return Err(UserError::InvalidMinTypoWordSetting(one, *two).into());
|
return Err(UserError::InvalidMinTypoWordLenSetting(one, *two).into());
|
||||||
} else {
|
} else {
|
||||||
self.index.put_min_word_len_2_typos(&mut self.wtxn, *two)?;
|
self.index.put_min_word_len_2_typos(&mut self.wtxn, *two)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user