mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
Rename FilterParsing into InvalidFilter
This commit is contained in:
parent
8cfe3e1ec0
commit
adf0c389c5
@ -53,7 +53,7 @@ pub enum UserError {
|
||||
Csv(csv::Error),
|
||||
MaxDatabaseSizeReached,
|
||||
DocumentLimitReached,
|
||||
FilterParsing(pest::error::Error<ParserRule>),
|
||||
InvalidFilter(pest::error::Error<ParserRule>),
|
||||
InvalidCriterionName { name: String },
|
||||
InvalidDocumentId { document_id: Value },
|
||||
InvalidFilterAttribute(pest::error::Error<ParserRule>),
|
||||
@ -199,7 +199,7 @@ impl fmt::Display for UserError {
|
||||
Self::AttributeLimitReached => f.write_str("maximum number of attributes reached"),
|
||||
Self::Csv(error) => error.fmt(f),
|
||||
Self::DocumentLimitReached => f.write_str("maximum number of documents reached"),
|
||||
Self::FilterParsing(error) => error.fmt(f),
|
||||
Self::InvalidFilter(error) => error.fmt(f),
|
||||
Self::InvalidCriterionName { name } => write!(f, "invalid criterion {}", name),
|
||||
Self::InvalidDocumentId { document_id } => {
|
||||
let json = serde_json::to_string(document_id).unwrap();
|
||||
|
@ -110,7 +110,7 @@ impl FilterCondition {
|
||||
{
|
||||
let fields_ids_map = index.fields_ids_map(rtxn)?;
|
||||
let filterable_fields = index.filterable_fields_ids(rtxn)?;
|
||||
let lexed = FilterParser::parse(Rule::prgm, expression).map_err(UserError::FilterParsing)?;
|
||||
let lexed = FilterParser::parse(Rule::prgm, expression).map_err(UserError::InvalidFilter)?;
|
||||
FilterCondition::from_pairs(&fields_ids_map, &filterable_fields, lexed)
|
||||
}
|
||||
|
||||
@ -169,8 +169,8 @@ impl FilterCondition {
|
||||
let (lresult, _) = pest_parse(items.next().unwrap());
|
||||
let (rresult, _) = pest_parse(items.next().unwrap());
|
||||
|
||||
let lvalue = lresult.map_err(UserError::FilterParsing)?;
|
||||
let rvalue = rresult.map_err(UserError::FilterParsing)?;
|
||||
let lvalue = lresult.map_err(UserError::InvalidFilter)?;
|
||||
let rvalue = rresult.map_err(UserError::InvalidFilter)?;
|
||||
|
||||
Ok(Operator(fid, Between(lvalue, rvalue)))
|
||||
}
|
||||
@ -204,7 +204,7 @@ impl FilterCondition {
|
||||
|
||||
let value = items.next().unwrap();
|
||||
let (result, _svalue) = pest_parse(value);
|
||||
let value = result.map_err(UserError::FilterParsing)?;
|
||||
let value = result.map_err(UserError::InvalidFilter)?;
|
||||
|
||||
Ok(Operator(fid, GreaterThan(value)))
|
||||
}
|
||||
@ -221,7 +221,7 @@ impl FilterCondition {
|
||||
|
||||
let value = items.next().unwrap();
|
||||
let (result, _svalue) = pest_parse(value);
|
||||
let value = result.map_err(UserError::FilterParsing)?;
|
||||
let value = result.map_err(UserError::InvalidFilter)?;
|
||||
|
||||
Ok(Operator(fid, GreaterThanOrEqual(value)))
|
||||
}
|
||||
@ -238,7 +238,7 @@ impl FilterCondition {
|
||||
|
||||
let value = items.next().unwrap();
|
||||
let (result, _svalue) = pest_parse(value);
|
||||
let value = result.map_err(UserError::FilterParsing)?;
|
||||
let value = result.map_err(UserError::InvalidFilter)?;
|
||||
|
||||
Ok(Operator(fid, LowerThan(value)))
|
||||
}
|
||||
@ -255,7 +255,7 @@ impl FilterCondition {
|
||||
|
||||
let value = items.next().unwrap();
|
||||
let (result, _svalue) = pest_parse(value);
|
||||
let value = result.map_err(UserError::FilterParsing)?;
|
||||
let value = result.map_err(UserError::InvalidFilter)?;
|
||||
|
||||
Ok(Operator(fid, LowerThanOrEqual(value)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user