mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
fmt
This commit is contained in:
parent
d7ad39ad77
commit
a53536836b
@ -28,7 +28,6 @@ impl From<BadGeoError> for AscDescError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl From<AscDescError> for CriterionError {
|
impl From<AscDescError> for CriterionError {
|
||||||
fn from(error: AscDescError) -> Self {
|
fn from(error: AscDescError) -> Self {
|
||||||
match error {
|
match error {
|
||||||
|
@ -389,14 +389,10 @@ impl<'a> Filter<'a> {
|
|||||||
let base_point: [f64; 2] =
|
let base_point: [f64; 2] =
|
||||||
[point[0].parse_finite_float()?, point[1].parse_finite_float()?];
|
[point[0].parse_finite_float()?, point[1].parse_finite_float()?];
|
||||||
if !(-90.0..=90.0).contains(&base_point[0]) {
|
if !(-90.0..=90.0).contains(&base_point[0]) {
|
||||||
return Err(
|
return Err(point[0].as_external_error(BadGeoError::Lat(base_point[0])))?;
|
||||||
point[0].as_external_error(BadGeoError::Lat(base_point[0]))
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
if !(-180.0..=180.0).contains(&base_point[1]) {
|
if !(-180.0..=180.0).contains(&base_point[1]) {
|
||||||
return Err(
|
return Err(point[1].as_external_error(BadGeoError::Lng(base_point[1])))?;
|
||||||
point[1].as_external_error(BadGeoError::Lng(base_point[1]))
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
let radius = radius.parse_finite_float()?;
|
let radius = radius.parse_finite_float()?;
|
||||||
let rtree = match index.geo_rtree(rtxn)? {
|
let rtree = match index.geo_rtree(rtxn)? {
|
||||||
@ -434,12 +430,14 @@ impl<'a> Filter<'a> {
|
|||||||
bottom_right_point[1].parse_finite_float()?,
|
bottom_right_point[1].parse_finite_float()?,
|
||||||
];
|
];
|
||||||
if !(-90.0..=90.0).contains(&top_left[0]) {
|
if !(-90.0..=90.0).contains(&top_left[0]) {
|
||||||
return Err(top_left_point[0]
|
return Err(
|
||||||
.as_external_error(BadGeoError::Lat(top_left[0])))?;
|
top_left_point[0].as_external_error(BadGeoError::Lat(top_left[0]))
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
if !(-180.0..=180.0).contains(&top_left[1]) {
|
if !(-180.0..=180.0).contains(&top_left[1]) {
|
||||||
return Err(top_left_point[1]
|
return Err(
|
||||||
.as_external_error(BadGeoError::Lng(top_left[1])))?;
|
top_left_point[1].as_external_error(BadGeoError::Lng(top_left[1]))
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
if !(-90.0..=90.0).contains(&bottom_right[0]) {
|
if !(-90.0..=90.0).contains(&bottom_right[0]) {
|
||||||
return Err(bottom_right_point[0]
|
return Err(bottom_right_point[0]
|
||||||
@ -451,10 +449,7 @@ impl<'a> Filter<'a> {
|
|||||||
}
|
}
|
||||||
if top_left[0] < bottom_right[0] {
|
if top_left[0] < bottom_right[0] {
|
||||||
return Err(bottom_right_point[1].as_external_error(
|
return Err(bottom_right_point[1].as_external_error(
|
||||||
BadGeoError::BoundingBoxTopIsBelowBottom(
|
BadGeoError::BoundingBoxTopIsBelowBottom(top_left[0], bottom_right[0]),
|
||||||
top_left[0],
|
|
||||||
bottom_right[0],
|
|
||||||
),
|
|
||||||
))?;
|
))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ use heed::types::{ByteSlice, DecodeIgnore};
|
|||||||
use heed::{BytesDecode, RoTxn};
|
use heed::{BytesDecode, RoTxn};
|
||||||
|
|
||||||
pub use self::facet_distribution::{FacetDistribution, DEFAULT_VALUES_PER_FACET};
|
pub use self::facet_distribution::{FacetDistribution, DEFAULT_VALUES_PER_FACET};
|
||||||
pub use self::filter::{Filter, BadGeoError};
|
pub use self::filter::{BadGeoError, Filter};
|
||||||
use crate::heed_codec::facet::{FacetGroupKeyCodec, FacetGroupValueCodec};
|
use crate::heed_codec::facet::{FacetGroupKeyCodec, FacetGroupValueCodec};
|
||||||
use crate::heed_codec::ByteSliceRefCodec;
|
use crate::heed_codec::ByteSliceRefCodec;
|
||||||
mod facet_distribution;
|
mod facet_distribution;
|
||||||
|
Loading…
Reference in New Issue
Block a user