mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
setting up facets
This commit is contained in:
parent
dd08cfc6a3
commit
59c67f6bc8
11 changed files with 633 additions and 139 deletions
|
@ -23,6 +23,7 @@ pub enum ResponseError {
|
|||
FilterParsing(String),
|
||||
RetrieveDocument(u64, String),
|
||||
SearchDocuments(String),
|
||||
FacetExpression(String),
|
||||
}
|
||||
|
||||
impl ResponseError {
|
||||
|
@ -106,6 +107,7 @@ impl fmt::Display for ResponseError {
|
|||
Self::OpenIndex(err) => write!(f, "Impossible to open index; {}", err),
|
||||
Self::RetrieveDocument(id, err) => write!(f, "impossible to retrieve the document with id: {}; {}", id, err),
|
||||
Self::SearchDocuments(err) => write!(f, "impossible to search documents; {}", err),
|
||||
Self::FacetExpression(e) => write!(f, "error parsing facet filter expression: {}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +127,7 @@ impl aweb::error::ResponseError for ResponseError {
|
|||
| Self::InvalidIndexUid
|
||||
| Self::OpenIndex(_)
|
||||
| Self::RetrieveDocument(_, _)
|
||||
| Self::FacetExpression(_)
|
||||
| Self::SearchDocuments(_)
|
||||
| Self::FilterParsing(_) => StatusCode::BAD_REQUEST,
|
||||
Self::DocumentNotFound(_)
|
||||
|
@ -151,6 +154,12 @@ impl From<meilisearch_core::FstError> for ResponseError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<meilisearch_core::FacetError> for ResponseError {
|
||||
fn from(error: meilisearch_core::FacetError) -> ResponseError {
|
||||
ResponseError::FacetExpression(error.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<meilisearch_core::Error> for ResponseError {
|
||||
fn from(err: meilisearch_core::Error) -> ResponseError {
|
||||
use meilisearch_core::pest_error::LineColLocation::*;
|
||||
|
@ -164,6 +173,7 @@ impl From<meilisearch_core::Error> for ResponseError {
|
|||
|
||||
ResponseError::FilterParsing(message)
|
||||
},
|
||||
meilisearch_core::Error::FacetError(e) => ResponseError::FacetExpression(e.to_string()),
|
||||
_ => ResponseError::Internal(err.to_string()),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue