only index _geo if it's set as sortable OR filterable

and only allow the filters if geo was set to filterable
This commit is contained in:
Tamo 2021-08-30 15:47:33 +02:00
parent f73273d71c
commit 5bb175fc90
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
3 changed files with 15 additions and 1 deletions

View file

@ -463,6 +463,9 @@ impl FilterCondition {
LowerThanOrEqual(val) => (Included(f64::MIN), Included(*val)),
Between(left, right) => (Included(*left), Included(*right)),
GeoLowerThan(point, distance) => {
if index.filterable_fields(rtxn)?.contains("_geo") {
Err(UserError::AttributeLimitReached)?; // TODO: TAMO use a real error
}
let mut result = RoaringBitmap::new();
let rtree = match index.geo_rtree(rtxn)? {
Some(rtree) => rtree,
@ -477,6 +480,9 @@ impl FilterCondition {
return Ok(result);
}
GeoGreaterThan(point, distance) => {
if index.filterable_fields(rtxn)?.contains("_geo") {
Err(UserError::AttributeLimitReached)?; // TODO: TAMO use a real error
}
let result = Self::evaluate_operator(
rtxn,
index,