mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
use meters in the filters
This commit is contained in:
parent
4f69b190bc
commit
e5ef0cad9a
3 changed files with 17 additions and 5 deletions
|
@ -504,17 +504,20 @@ impl FilterCondition {
|
|||
LowerThan(val) => (Included(f64::MIN), Excluded(*val)),
|
||||
LowerThanOrEqual(val) => (Included(f64::MIN), Included(*val)),
|
||||
Between(left, right) => (Included(*left), Included(*right)),
|
||||
GeoLowerThan(point, distance) => {
|
||||
GeoLowerThan(base_point, distance) => {
|
||||
let mut result = RoaringBitmap::new();
|
||||
let rtree = match index.geo_rtree(rtxn)? {
|
||||
Some(rtree) => rtree,
|
||||
None => return Ok(result),
|
||||
};
|
||||
|
||||
let iter = rtree
|
||||
.nearest_neighbor_iter_with_distance_2(point)
|
||||
.take_while(|(_, dist)| dist <= distance);
|
||||
iter.for_each(|(point, _)| drop(result.insert(point.data)));
|
||||
rtree
|
||||
.nearest_neighbor_iter(base_point)
|
||||
.take_while(|point| {
|
||||
dbg!(crate::distance_between_two_points(base_point, point.geom()))
|
||||
< *distance
|
||||
})
|
||||
.for_each(|point| drop(result.insert(point.data)));
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue