mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
remove everything about pest
This commit is contained in:
parent
ac1df9d9d7
commit
f7796edc7e
@ -24,7 +24,6 @@ levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] }
|
|||||||
linked-hash-map = "0.5.4"
|
linked-hash-map = "0.5.4"
|
||||||
meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" }
|
meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", tag = "v0.2.5" }
|
||||||
memmap = "0.7.0"
|
memmap = "0.7.0"
|
||||||
nom = "7"
|
|
||||||
obkv = "0.2.0"
|
obkv = "0.2.0"
|
||||||
once_cell = "1.5.2"
|
once_cell = "1.5.2"
|
||||||
ordered-float = "2.1.1"
|
ordered-float = "2.1.1"
|
||||||
@ -40,8 +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
|
||||||
pest = { git = "https://github.com/pest-parser/pest.git", rev = "51fd1d49f1041f7839975664ef71fe15c7dcaf67" }
|
nom = "7"
|
||||||
pest_derive = "2.1.0"
|
|
||||||
|
|
||||||
# documents words self-join
|
# documents words self-join
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
|
@ -7,7 +7,6 @@ use heed::{Error as HeedError, MdbError};
|
|||||||
use rayon::ThreadPoolBuildError;
|
use rayon::ThreadPoolBuildError;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
|
|
||||||
use crate::search::ParserRule;
|
|
||||||
use crate::{CriterionError, DocumentId, FieldId, SortError};
|
use crate::{CriterionError, DocumentId, FieldId, SortError};
|
||||||
|
|
||||||
pub type Object = Map<String, Value>;
|
pub type Object = Map<String, Value>;
|
||||||
@ -59,8 +58,6 @@ pub enum UserError {
|
|||||||
DocumentLimitReached,
|
DocumentLimitReached,
|
||||||
InvalidDocumentId { document_id: Value },
|
InvalidDocumentId { document_id: Value },
|
||||||
InvalidFacetsDistribution { invalid_facets_name: HashSet<String> },
|
InvalidFacetsDistribution { invalid_facets_name: HashSet<String> },
|
||||||
InvalidFilter(pest::error::Error<ParserRule>),
|
|
||||||
InvalidFilterAttribute(pest::error::Error<ParserRule>),
|
|
||||||
InvalidGeoField { document_id: Value, object: Value },
|
InvalidGeoField { document_id: Value, object: Value },
|
||||||
InvalidFilterAttributeNom,
|
InvalidFilterAttributeNom,
|
||||||
InvalidFilterValue,
|
InvalidFilterValue,
|
||||||
@ -226,12 +223,15 @@ impl fmt::Display for UserError {
|
|||||||
name_list
|
name_list
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::InvalidFilter(error) => error.fmt(f),
|
|
||||||
Self::InvalidGeoField { document_id, object } => write!(
|
Self::InvalidGeoField { document_id, object } => write!(
|
||||||
f,
|
f,
|
||||||
"the document with the id: {} contains an invalid _geo field: {}",
|
"the document with the id: {} contains an invalid _geo field: {}",
|
||||||
document_id, object
|
document_id, object
|
||||||
),
|
),
|
||||||
|
Self::InvalidAscDescSyntax { name } => {
|
||||||
|
write!(f, "invalid asc/desc syntax for {}", 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();
|
||||||
write!(
|
write!(
|
||||||
@ -242,7 +242,9 @@ only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and undersco
|
|||||||
json
|
json
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Self::InvalidFilterAttribute(error) => error.fmt(f),
|
Self::InvalidSortName { name } => {
|
||||||
|
write!(f, "Invalid syntax for the sort parameter: {}", name)
|
||||||
|
}
|
||||||
Self::InvalidSortableAttribute { field, valid_fields } => {
|
Self::InvalidSortableAttribute { field, valid_fields } => {
|
||||||
let valid_names =
|
let valid_names =
|
||||||
valid_fields.iter().map(AsRef::as_ref).collect::<Vec<_>>().join(", ");
|
valid_fields.iter().map(AsRef::as_ref).collect::<Vec<_>>().join(", ");
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#[macro_use]
|
|
||||||
extern crate pest_derive;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod documents;
|
pub mod documents;
|
||||||
|
|
||||||
|
@ -23,8 +23,7 @@ use nom::{
|
|||||||
|
|
||||||
use self::FilterCondition::*;
|
use self::FilterCondition::*;
|
||||||
use self::Operator::*;
|
use self::Operator::*;
|
||||||
use super::parser::FilterParser;
|
|
||||||
use super::parser::{Rule, PREC_CLIMBER};
|
|
||||||
use super::FacetNumberRange;
|
use super::FacetNumberRange;
|
||||||
use crate::error::{Error, UserError};
|
use crate::error::{Error, UserError};
|
||||||
use crate::heed_codec::facet::{
|
use crate::heed_codec::facet::{
|
||||||
|
@ -2,10 +2,8 @@ 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;
|
||||||
pub use self::filter_condition::{FilterCondition, Operator};
|
pub use self::filter_condition::{FilterCondition, Operator};
|
||||||
pub(crate) use self::parser::Rule as ParserRule;
|
|
||||||
|
|
||||||
mod facet_distribution;
|
mod facet_distribution;
|
||||||
mod facet_number;
|
mod facet_number;
|
||||||
mod facet_string;
|
mod facet_string;
|
||||||
mod filter_condition;
|
mod filter_condition;
|
||||||
mod parser;
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
use once_cell::sync::Lazy;
|
|
||||||
use pest::prec_climber::{Assoc, Operator, PrecClimber};
|
|
||||||
|
|
||||||
pub static PREC_CLIMBER: Lazy<PrecClimber<Rule>> = Lazy::new(|| {
|
|
||||||
use Assoc::*;
|
|
||||||
use Rule::*;
|
|
||||||
pest::prec_climber::PrecClimber::new(vec![Operator::new(or, Left), Operator::new(and, Left)])
|
|
||||||
});
|
|
||||||
|
|
||||||
#[derive(Parser)]
|
|
||||||
#[grammar = "search/facet/grammar.pest"]
|
|
||||||
pub struct FilterParser;
|
|
@ -14,7 +14,6 @@ use meilisearch_tokenizer::{Analyzer, AnalyzerConfig};
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use roaring::bitmap::RoaringBitmap;
|
use roaring::bitmap::RoaringBitmap;
|
||||||
|
|
||||||
pub(crate) use self::facet::ParserRule;
|
|
||||||
pub use self::facet::{FacetDistribution, FacetNumberIter, FilterCondition, Operator};
|
pub use self::facet::{FacetDistribution, FacetNumberIter, FilterCondition, Operator};
|
||||||
pub use self::matching_words::MatchingWords;
|
pub use self::matching_words::MatchingWords;
|
||||||
use self::query_tree::QueryTreeBuilder;
|
use self::query_tree::QueryTreeBuilder;
|
||||||
|
Loading…
Reference in New Issue
Block a user