mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
remove the !
syntax for the not
This commit is contained in:
parent
73df873f44
commit
519d6b2bf3
@ -5,7 +5,7 @@
|
|||||||
//! expression = or
|
//! expression = or
|
||||||
//! or = and (~ "OR" ~ and)
|
//! or = and (~ "OR" ~ and)
|
||||||
//! and = not (~ "AND" not)*
|
//! and = not (~ "AND" not)*
|
||||||
//! not = ("NOT" | "!") not | primary
|
//! not = ("NOT" ~ not) | primary
|
||||||
//! primary = (WS* ~ "(" expression ")" ~ WS*) | geoRadius | condition | to
|
//! primary = (WS* ~ "(" expression ")" ~ WS*) | geoRadius | condition | to
|
||||||
//! condition = value ("==" | ">" ...) value
|
//! condition = value ("==" | ">" ...) value
|
||||||
//! to = value value TO value
|
//! to = value value TO value
|
||||||
@ -169,13 +169,11 @@ fn parse_and(input: Span) -> IResult<FilterCondition> {
|
|||||||
Ok((input, expr))
|
Ok((input, expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// not = ("NOT" | "!") not | primary
|
/// not = ("NOT" ~ not) | primary
|
||||||
/// We can have multiple consecutive not, eg: `NOT NOT channel = mv`.
|
/// We can have multiple consecutive not, eg: `NOT NOT channel = mv`.
|
||||||
/// If we parse a `NOT` or `!` we MUST parse something behind.
|
/// If we parse a `NOT` we MUST parse something behind.
|
||||||
fn parse_not(input: Span) -> IResult<FilterCondition> {
|
fn parse_not(input: Span) -> IResult<FilterCondition> {
|
||||||
alt((map(preceded(alt((tag("!"), tag("NOT"))), cut(parse_not)), |e| e.negate()), parse_primary))(
|
alt((map(preceded(tag("NOT"), cut(parse_not)), |e| e.negate()), parse_primary))(input)
|
||||||
input,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// geoRadius = WS* ~ "_geoRadius(float ~ "," ~ float ~ "," float)
|
/// geoRadius = WS* ~ "_geoRadius(float ~ "," ~ float ~ "," float)
|
||||||
|
@ -70,7 +70,7 @@ fn is_value_component(c: char) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_syntax_component(c: char) -> bool {
|
fn is_syntax_component(c: char) -> bool {
|
||||||
c.is_whitespace() || ['(', ')', '=', '<', '>', '!'].contains(&c)
|
c.is_whitespace() || ['(', ')', '=', '<', '>'].contains(&c)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user