mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 16:51:01 +00:00
start updating the exposed function to makes other modules happy
This commit is contained in:
@ -2,5 +2,7 @@ mod facet_type;
|
||||
mod facet_value;
|
||||
pub mod value_encoding;
|
||||
|
||||
pub use filter_parser::{Condition, FilterCondition, FilterParserError, Span, Token};
|
||||
|
||||
pub use self::facet_type::FacetType;
|
||||
pub use self::facet_value::FacetValue;
|
||||
|
@ -34,7 +34,9 @@ pub use self::heed_codec::{
|
||||
RoaringBitmapLenCodec, StrBEU32Codec, StrStrU8Codec,
|
||||
};
|
||||
pub use self::index::Index;
|
||||
pub use self::search::{FacetDistribution, Filter, MatchingWords, Search, SearchResult};
|
||||
pub use self::search::{
|
||||
Condition, FacetDistribution, Filter, FilterCondition, MatchingWords, Search, SearchResult,
|
||||
};
|
||||
|
||||
pub type Result<T> = std::result::Result<T, error::Error>;
|
||||
|
||||
|
@ -3,7 +3,7 @@ use std::ops::Bound::{self, Excluded, Included};
|
||||
use std::str::FromStr;
|
||||
|
||||
use either::Either;
|
||||
use filter_parser::{Condition, FilterCondition, FilterParserError, Span, Token};
|
||||
pub use filter_parser::{Condition, FilterCondition, FilterParserError, Span, Token};
|
||||
use heed::types::DecodeIgnore;
|
||||
use log::debug;
|
||||
use nom::error::{ErrorKind, VerboseError};
|
||||
@ -209,7 +209,7 @@ impl<'a> Filter<'a> {
|
||||
// Make sure we always bound the ranges with the field id and the level,
|
||||
// as the facets values are all in the same database and prefixed by the
|
||||
// field id and the level.
|
||||
// TODO TAMO: return good error when we can't parse a span
|
||||
|
||||
let (left, right) = match operator {
|
||||
Condition::GreaterThan(val) => (Excluded(parse(val)?), Included(f64::MAX)),
|
||||
Condition::GreaterThanOrEqual(val) => (Included(parse(val)?), Included(f64::MAX)),
|
||||
@ -315,10 +315,15 @@ impl<'a> Filter<'a> {
|
||||
|
||||
match &self.condition {
|
||||
FilterCondition::Condition { fid, op } => {
|
||||
// TODO: parse fid
|
||||
let _ = fid;
|
||||
let fid = 42;
|
||||
Self::evaluate_operator(rtxn, index, numbers_db, strings_db, fid, &op)
|
||||
let filterable_fields = index.fields_ids_map(rtxn)?;
|
||||
if let Some(fid) = filterable_fields.id(fid.inner) {
|
||||
Self::evaluate_operator(rtxn, index, numbers_db, strings_db, fid, &op)
|
||||
} else {
|
||||
// TODO TAMO: update the error message
|
||||
return Err(UserError::InvalidFilter {
|
||||
input: format!("Bad filter, available filters are {:?}", filterable_fields),
|
||||
})?;
|
||||
}
|
||||
}
|
||||
FilterCondition::Or(lhs, rhs) => {
|
||||
let lhs = Self::evaluate(&(lhs.as_ref().clone()).into(), rtxn, index)?;
|
||||
|
@ -1,3 +1,5 @@
|
||||
pub use filter_parser::{Condition, FilterCondition};
|
||||
|
||||
pub use self::facet_distribution::FacetDistribution;
|
||||
pub use self::facet_number::{FacetNumberIter, FacetNumberRange, FacetNumberRevRange};
|
||||
pub use self::facet_string::FacetStringIter;
|
||||
|
@ -14,7 +14,7 @@ use meilisearch_tokenizer::{Analyzer, AnalyzerConfig};
|
||||
use once_cell::sync::Lazy;
|
||||
use roaring::bitmap::RoaringBitmap;
|
||||
|
||||
pub use self::facet::{FacetDistribution, FacetNumberIter, Filter};
|
||||
pub use self::facet::{Condition, FacetDistribution, FacetNumberIter, Filter, FilterCondition};
|
||||
pub use self::matching_words::MatchingWords;
|
||||
use self::query_tree::QueryTreeBuilder;
|
||||
use crate::error::UserError;
|
||||
|
Reference in New Issue
Block a user