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