mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Differentiate between document sort error and search sort error
This commit is contained in:
parent
8aacd6374a
commit
283944ea89
7 changed files with 20 additions and 16 deletions
|
@ -168,6 +168,16 @@ pub enum SortError {
|
|||
ReservedNameForFilter { name: String },
|
||||
}
|
||||
|
||||
impl SortError {
|
||||
pub fn into_search_error(self) -> Error {
|
||||
Error::UserError(UserError::SortError { error: self, search: true })
|
||||
}
|
||||
|
||||
pub fn into_documents_error(self) -> Error {
|
||||
Error::UserError(UserError::SortError { error: self, search: false })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AscDescError> for SortError {
|
||||
fn from(error: AscDescError) -> Self {
|
||||
match error {
|
||||
|
@ -190,12 +200,6 @@ impl From<AscDescError> for SortError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<SortError> for Error {
|
||||
fn from(error: SortError) -> Self {
|
||||
Self::UserError(UserError::SortError(error))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use big_s::S;
|
||||
|
|
|
@ -272,8 +272,8 @@ and can not be more than 511 bytes.", .document_id.to_string()
|
|||
PrimaryKeyCannotBeChanged(String),
|
||||
#[error(transparent)]
|
||||
SerdeJson(serde_json::Error),
|
||||
#[error(transparent)]
|
||||
SortError(#[from] SortError),
|
||||
#[error("{error}")]
|
||||
SortError { error: SortError, search: bool },
|
||||
#[error("An unknown internal document id have been used: `{document_id}`.")]
|
||||
UnknownInternalDocumentId { document_id: DocumentId },
|
||||
#[error("`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: {0}` and twoTypos: {1}`.")]
|
||||
|
|
|
@ -411,7 +411,7 @@ pub fn recursive_facet_sort<'ctx>(
|
|||
// FIXME: Should this return an error if the field is not found?
|
||||
}
|
||||
|
||||
let geo_candidates = if need_geo_candidates {
|
||||
let geo_candidates = if need_geo_candidates {
|
||||
index.geo_faceted_documents_ids(rtxn)?
|
||||
} else {
|
||||
RoaringBitmap::new()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue