mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
update milli with the new parser_filter
This commit is contained in:
parent
b1a0110a47
commit
a58bc5bebb
@ -38,10 +38,7 @@ smallvec = "1.6.1"
|
|||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
uuid = { version = "0.8.2", features = ["v4"] }
|
uuid = { version = "0.8.2", features = ["v4"] }
|
||||||
|
|
||||||
# facet filter parser
|
|
||||||
filter_parser = { path = "../filter_parser" }
|
filter_parser = { path = "../filter_parser" }
|
||||||
nom = "7.0.0"
|
|
||||||
nom-greedyerror = "0.4.0"
|
|
||||||
|
|
||||||
# documents words self-join
|
# documents words self-join
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
|
@ -2,7 +2,5 @@ mod facet_type;
|
|||||||
mod facet_value;
|
mod facet_value;
|
||||||
pub mod value_encoding;
|
pub mod value_encoding;
|
||||||
|
|
||||||
pub use filter_parser::{Condition, FilterCondition, FilterParserError, Span, Token};
|
|
||||||
|
|
||||||
pub use self::facet_type::FacetType;
|
pub use self::facet_type::FacetType;
|
||||||
pub use self::facet_value::FacetValue;
|
pub use self::facet_value::FacetValue;
|
||||||
|
@ -17,6 +17,7 @@ use std::collections::{BTreeMap, HashMap};
|
|||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::hash::BuildHasherDefault;
|
use std::hash::BuildHasherDefault;
|
||||||
|
|
||||||
|
pub use filter_parser::{Condition, FilterCondition};
|
||||||
use fxhash::{FxHasher32, FxHasher64};
|
use fxhash::{FxHasher32, FxHasher64};
|
||||||
pub use grenad::CompressionType;
|
pub use grenad::CompressionType;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
@ -34,9 +35,7 @@ pub use self::heed_codec::{
|
|||||||
RoaringBitmapLenCodec, StrBEU32Codec, StrStrU8Codec,
|
RoaringBitmapLenCodec, StrBEU32Codec, StrStrU8Codec,
|
||||||
};
|
};
|
||||||
pub use self::index::Index;
|
pub use self::index::Index;
|
||||||
pub use self::search::{
|
pub use self::search::{FacetDistribution, Filter, MatchingWords, Search, SearchResult};
|
||||||
Condition, FacetDistribution, Filter, FilterCondition, MatchingWords, Search, SearchResult,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, error::Error>;
|
pub type Result<T> = std::result::Result<T, error::Error>;
|
||||||
|
|
||||||
|
@ -3,11 +3,9 @@ use std::ops::Bound::{self, Excluded, Included};
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use either::Either;
|
use either::Either;
|
||||||
pub use filter_parser::{Condition, FilterCondition, FilterParserError, Span, Token};
|
pub use filter_parser::{Condition, Error as FPError, FilterCondition, Span, Token};
|
||||||
use heed::types::DecodeIgnore;
|
use heed::types::DecodeIgnore;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use nom::error::{ErrorKind, VerboseError};
|
|
||||||
use nom_greedyerror::{convert_error, GreedyError};
|
|
||||||
use roaring::RoaringBitmap;
|
use roaring::RoaringBitmap;
|
||||||
|
|
||||||
use super::FacetNumberRange;
|
use super::FacetNumberRange;
|
||||||
@ -22,12 +20,6 @@ pub struct Filter<'a> {
|
|||||||
condition: FilterCondition<'a>,
|
condition: FilterCondition<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<VerboseError<Span<'a>>> for Error {
|
|
||||||
fn from(nom_error: VerboseError<Span<'a>>) -> Self {
|
|
||||||
UserError::InvalidFilter { input: nom_error.to_string() }.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse<T: FromStr>(tok: &Token) -> Result<T> {
|
fn parse<T: FromStr>(tok: &Token) -> Result<T> {
|
||||||
match tok.inner.parse::<T>() {
|
match tok.inner.parse::<T>() {
|
||||||
Ok(t) => Ok(t),
|
Ok(t) => Ok(t),
|
||||||
@ -90,11 +82,9 @@ impl<'a> Filter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_str(expression: &'a str) -> Result<Self> {
|
pub fn from_str(expression: &'a str) -> Result<Self> {
|
||||||
let condition = match FilterCondition::parse::<GreedyError<Span, ErrorKind>>(expression) {
|
let condition = match FilterCondition::parse(expression) {
|
||||||
Ok(fc) => Ok(fc),
|
Ok(fc) => Ok(fc),
|
||||||
Err(e) => Err(Error::UserError(UserError::InvalidFilter {
|
Err(e) => Err(Error::UserError(UserError::InvalidFilter { input: e.to_string() })),
|
||||||
input: convert_error(Span::new_extra(expression, expression), e).to_string(),
|
|
||||||
})),
|
|
||||||
}?;
|
}?;
|
||||||
Ok(Self { condition })
|
Ok(Self { condition })
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
pub use filter_parser::{Condition, FilterCondition};
|
|
||||||
|
|
||||||
pub use self::facet_distribution::FacetDistribution;
|
pub use self::facet_distribution::FacetDistribution;
|
||||||
pub use self::facet_number::{FacetNumberIter, FacetNumberRange, FacetNumberRevRange};
|
pub use self::facet_number::{FacetNumberIter, FacetNumberRange, FacetNumberRevRange};
|
||||||
pub use self::facet_string::FacetStringIter;
|
pub use self::facet_string::FacetStringIter;
|
||||||
|
@ -14,7 +14,7 @@ use meilisearch_tokenizer::{Analyzer, AnalyzerConfig};
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use roaring::bitmap::RoaringBitmap;
|
use roaring::bitmap::RoaringBitmap;
|
||||||
|
|
||||||
pub use self::facet::{Condition, FacetDistribution, FacetNumberIter, Filter, FilterCondition};
|
pub use self::facet::{FacetDistribution, FacetNumberIter, Filter};
|
||||||
pub use self::matching_words::MatchingWords;
|
pub use self::matching_words::MatchingWords;
|
||||||
use self::query_tree::QueryTreeBuilder;
|
use self::query_tree::QueryTreeBuilder;
|
||||||
use crate::error::UserError;
|
use crate::error::UserError;
|
||||||
|
Loading…
Reference in New Issue
Block a user