mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-25 06:00:08 +01:00
add a check on the fid in the geosearch
This commit is contained in:
parent
3942b3732f
commit
c8d03046bf
@ -309,7 +309,11 @@ impl<'a> Filter<'a> {
|
|||||||
}
|
}
|
||||||
FilterCondition::Empty => Ok(RoaringBitmap::new()),
|
FilterCondition::Empty => Ok(RoaringBitmap::new()),
|
||||||
FilterCondition::GeoLowerThan { point, radius } => {
|
FilterCondition::GeoLowerThan { point, radius } => {
|
||||||
|
let filterable_fields = index.fields_ids_map(rtxn)?;
|
||||||
|
if filterable_fields.id("_geo").is_some() {
|
||||||
let base_point = [parse(&point[0])?, parse(&point[1])?];
|
let base_point = [parse(&point[0])?, parse(&point[1])?];
|
||||||
|
// TODO TAMO: ensure lat is between -90 and 90
|
||||||
|
// TODO TAMO: ensure lng is between -180 and 180
|
||||||
let radius = parse(&radius)?;
|
let radius = parse(&radius)?;
|
||||||
let rtree = match index.geo_rtree(rtxn)? {
|
let rtree = match index.geo_rtree(rtxn)? {
|
||||||
Some(rtree) => rtree,
|
Some(rtree) => rtree,
|
||||||
@ -324,7 +328,13 @@ impl<'a> Filter<'a> {
|
|||||||
.map(|point| point.data)
|
.map(|point| point.data)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
return Ok(result);
|
Ok(result)
|
||||||
|
} else {
|
||||||
|
// TODO TAMO: update the error message
|
||||||
|
return Err(UserError::InvalidFilter {
|
||||||
|
input: format!("You tried to use _geo in a filter, you probably wanted to use _geoRadius"),
|
||||||
|
})?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FilterCondition::GeoGreaterThan { point, radius } => {
|
FilterCondition::GeoGreaterThan { point, radius } => {
|
||||||
let result = Self::evaluate(
|
let result = Self::evaluate(
|
||||||
@ -334,7 +344,7 @@ impl<'a> Filter<'a> {
|
|||||||
index,
|
index,
|
||||||
)?;
|
)?;
|
||||||
let geo_faceted_doc_ids = index.geo_faceted_documents_ids(rtxn)?;
|
let geo_faceted_doc_ids = index.geo_faceted_documents_ids(rtxn)?;
|
||||||
return Ok(geo_faceted_doc_ids - result);
|
Ok(geo_faceted_doc_ids - result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user