follow the suggestions

This commit is contained in:
刘瀚骋 2021-10-14 21:37:59 +08:00
parent 2ea2f7570c
commit 7666e4f34a
3 changed files with 5 additions and 9 deletions

View File

@ -39,7 +39,7 @@ tempfile = "3.2.0"
uuid = { version = "0.8.2", features = ["v4"] }
# facet filter parser
nom = "7"
nom = "7.0.0"
# documents words self-join
itertools = "0.10.0"

View File

@ -24,9 +24,6 @@ pub enum FilterCondition {
Empty,
}
// impl From<std::>
//for nom
impl FilterCondition {
pub fn from_array<I, J, A, B>(
rtxn: &heed::RoTxn,
@ -72,6 +69,7 @@ impl FilterCondition {
Ok(ands)
}
pub fn from_str(
rtxn: &heed::RoTxn,
index: &Index,

View File

@ -49,6 +49,7 @@ pub trait FilterParserError<'a>:
nom::error::ParseError<&'a str> + ContextError<&'a str> + std::fmt::Debug
{
}
impl<'a> FilterParserError<'a> for VerboseError<&'a str> {}
pub struct ParseContext<'a> {
@ -211,7 +212,6 @@ impl<'a> ParseContext<'a> {
E: FilterParserError<'a>,
{
let err_msg_args_incomplete= "_geoRadius. The `_geoRadius` filter expect three arguments: `_geoRadius(latitude, longitude, radius)`";
let err_msg_latitude_invalid =
"_geoRadius. Latitude must be contained between -90 and 90 degrees.";
@ -275,8 +275,7 @@ impl<'a> ParseContext<'a> {
let l1 = |c| self.parse_simple_condition(c);
let l2 = |c| self.parse_range_condition(c);
let l3 = |c| self.parse_geo_radius(c);
let (input, condition) = alt((l1, l2, l3))(input)?;
Ok((input, condition))
alt((l1, l2, l3))(input)
}
fn parse_condition_expression<E>(&'a self, input: &'a str) -> IResult<&str, FilterCondition, E>
@ -313,8 +312,7 @@ impl<'a> ParseContext<'a> {
where
E: FilterParserError<'a>,
{
let a = self.parse_or(input);
a
self.parse_or(input)
}
}