mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
remove unnecessary FilterError:ReservedGeo and FilterError:ReservedGeo
This commit is contained in:
parent
52b4090286
commit
fddfb37f1f
@ -54,8 +54,6 @@ impl Display for BadGeoError {
|
|||||||
enum FilterError<'a> {
|
enum FilterError<'a> {
|
||||||
AttributeNotFilterable { attribute: &'a str, filterable_fields: HashSet<String> },
|
AttributeNotFilterable { attribute: &'a str, filterable_fields: HashSet<String> },
|
||||||
ParseGeoError(BadGeoError),
|
ParseGeoError(BadGeoError),
|
||||||
ReservedGeo(&'a str),
|
|
||||||
Reserved(&'a str),
|
|
||||||
TooDeep,
|
TooDeep,
|
||||||
}
|
}
|
||||||
impl<'a> std::error::Error for FilterError<'a> {}
|
impl<'a> std::error::Error for FilterError<'a> {}
|
||||||
@ -96,12 +94,6 @@ impl<'a> Display for FilterError<'a> {
|
|||||||
"Too many filter conditions, can't process more than {} filters.",
|
"Too many filter conditions, can't process more than {} filters.",
|
||||||
MAX_FILTER_DEPTH
|
MAX_FILTER_DEPTH
|
||||||
),
|
),
|
||||||
Self::ReservedGeo(keyword) => write!(f, "`{}` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` field coordinates.", keyword),
|
|
||||||
Self::Reserved(keyword) => write!(
|
|
||||||
f,
|
|
||||||
"`{}` is a reserved keyword and thus can't be used as a filter expression.",
|
|
||||||
keyword
|
|
||||||
),
|
|
||||||
Self::ParseGeoError(error) => write!(f, "{}", error),
|
Self::ParseGeoError(error) => write!(f, "{}", error),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,15 +325,6 @@ impl<'a> Filter<'a> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match fid.value() {
|
match fid.value() {
|
||||||
attribute @ "_geo" => {
|
|
||||||
Err(fid.as_external_error(FilterError::ReservedGeo(attribute)))?
|
|
||||||
}
|
|
||||||
attribute if attribute.starts_with("_geoPoint(") => {
|
|
||||||
Err(fid.as_external_error(FilterError::ReservedGeo("_geoPoint")))?
|
|
||||||
}
|
|
||||||
attribute @ "_geoDistance" => {
|
|
||||||
Err(fid.as_external_error(FilterError::Reserved(attribute)))?
|
|
||||||
}
|
|
||||||
attribute => {
|
attribute => {
|
||||||
Err(fid.as_external_error(FilterError::AttributeNotFilterable {
|
Err(fid.as_external_error(FilterError::AttributeNotFilterable {
|
||||||
attribute,
|
attribute,
|
||||||
|
Loading…
Reference in New Issue
Block a user