mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
follow the suggestions
This commit is contained in:
parent
2ea2f7570c
commit
7666e4f34a
@ -39,7 +39,7 @@ tempfile = "3.2.0"
|
|||||||
uuid = { version = "0.8.2", features = ["v4"] }
|
uuid = { version = "0.8.2", features = ["v4"] }
|
||||||
|
|
||||||
# facet filter parser
|
# facet filter parser
|
||||||
nom = "7"
|
nom = "7.0.0"
|
||||||
|
|
||||||
# documents words self-join
|
# documents words self-join
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
|
@ -24,9 +24,6 @@ pub enum FilterCondition {
|
|||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl From<std::>
|
|
||||||
|
|
||||||
//for nom
|
|
||||||
impl FilterCondition {
|
impl FilterCondition {
|
||||||
pub fn from_array<I, J, A, B>(
|
pub fn from_array<I, J, A, B>(
|
||||||
rtxn: &heed::RoTxn,
|
rtxn: &heed::RoTxn,
|
||||||
@ -72,6 +69,7 @@ impl FilterCondition {
|
|||||||
|
|
||||||
Ok(ands)
|
Ok(ands)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_str(
|
pub fn from_str(
|
||||||
rtxn: &heed::RoTxn,
|
rtxn: &heed::RoTxn,
|
||||||
index: &Index,
|
index: &Index,
|
||||||
|
@ -49,6 +49,7 @@ pub trait FilterParserError<'a>:
|
|||||||
nom::error::ParseError<&'a str> + ContextError<&'a str> + std::fmt::Debug
|
nom::error::ParseError<&'a str> + ContextError<&'a str> + std::fmt::Debug
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FilterParserError<'a> for VerboseError<&'a str> {}
|
impl<'a> FilterParserError<'a> for VerboseError<&'a str> {}
|
||||||
|
|
||||||
pub struct ParseContext<'a> {
|
pub struct ParseContext<'a> {
|
||||||
@ -211,7 +212,6 @@ impl<'a> ParseContext<'a> {
|
|||||||
E: FilterParserError<'a>,
|
E: FilterParserError<'a>,
|
||||||
{
|
{
|
||||||
let err_msg_args_incomplete= "_geoRadius. The `_geoRadius` filter expect three arguments: `_geoRadius(latitude, longitude, radius)`";
|
let err_msg_args_incomplete= "_geoRadius. The `_geoRadius` filter expect three arguments: `_geoRadius(latitude, longitude, radius)`";
|
||||||
|
|
||||||
let err_msg_latitude_invalid =
|
let err_msg_latitude_invalid =
|
||||||
"_geoRadius. Latitude must be contained between -90 and 90 degrees.";
|
"_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 l1 = |c| self.parse_simple_condition(c);
|
||||||
let l2 = |c| self.parse_range_condition(c);
|
let l2 = |c| self.parse_range_condition(c);
|
||||||
let l3 = |c| self.parse_geo_radius(c);
|
let l3 = |c| self.parse_geo_radius(c);
|
||||||
let (input, condition) = alt((l1, l2, l3))(input)?;
|
alt((l1, l2, l3))(input)
|
||||||
Ok((input, condition))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_condition_expression<E>(&'a self, input: &'a str) -> IResult<&str, FilterCondition, E>
|
fn parse_condition_expression<E>(&'a self, input: &'a str) -> IResult<&str, FilterCondition, E>
|
||||||
@ -313,8 +312,7 @@ impl<'a> ParseContext<'a> {
|
|||||||
where
|
where
|
||||||
E: FilterParserError<'a>,
|
E: FilterParserError<'a>,
|
||||||
{
|
{
|
||||||
let a = self.parse_or(input);
|
self.parse_or(input)
|
||||||
a
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user