Reduce identations

This commit is contained in:
Mubelotix
2025-08-19 13:29:19 +02:00
committed by Tamo
parent 3a0893a64d
commit 27a8088c85

View File

@ -617,7 +617,10 @@ impl<'a> Filter<'a> {
.union(),
FilterCondition::And(subfilters) => {
let mut subfilters_iter = subfilters.iter();
if let Some(first_subfilter) = subfilters_iter.next() {
let Some(first_subfilter) = subfilters_iter.next() else {
return Ok(RoaringBitmap::new());
};
let mut bitmap = Self::inner_evaluate(
&(first_subfilter.clone()).into(),
rtxn,
@ -643,15 +646,21 @@ impl<'a> Filter<'a> {
)?;
}
Ok(bitmap)
} else {
Ok(RoaringBitmap::new())
}
}
FilterCondition::VectorExists { fid: _, embedder, filter } => {
super::filter_vector::evaluate(rtxn, index, universe, embedder.clone(), filter)
}
FilterCondition::GeoLowerThan { point, radius } => {
if index.is_geo_filtering_enabled(rtxn)? {
if !index.is_geo_filtering_enabled(rtxn)? {
return Err(point[0].as_external_error(FilterError::AttributeNotFilterable {
attribute: RESERVED_GEO_FIELD_NAME,
filterable_patterns: filtered_matching_patterns(
filterable_attribute_rules,
&|features| features.is_filterable(),
),
}))?;
}
let base_point: [f64; 2] =
[point[0].parse_finite_float()?, point[1].parse_finite_float()?];
if !(-90.0..=90.0).contains(&base_point[0]) {
@ -678,15 +687,6 @@ impl<'a> Filter<'a> {
.collect();
Ok(result)
} else {
Err(point[0].as_external_error(FilterError::AttributeNotFilterable {
attribute: RESERVED_GEO_FIELD_NAME,
filterable_patterns: filtered_matching_patterns(
filterable_attribute_rules,
&|features| features.is_filterable(),
),
}))?
}
}
FilterCondition::GeoBoundingBox { top_right_point, bottom_left_point } => {
let top_right: [f64; 2] = [
@ -858,7 +858,18 @@ impl<'a> Filter<'a> {
}
}
FilterCondition::GeoPolygon { points } => {
if index.is_geojson_filtering_enabled(rtxn)? {
if !index.is_geojson_filtering_enabled(rtxn)? {
return Err(points[0][0].as_external_error(
FilterError::AttributeNotFilterable {
attribute: RESERVED_GEOJSON_FIELD_NAME,
filterable_patterns: filtered_matching_patterns(
filterable_attribute_rules,
&|features| features.is_filterable(),
),
},
))?;
}
let polygon = geo_types::Polygon::new(
geo_types::LineString(
points
@ -881,15 +892,6 @@ impl<'a> Filter<'a> {
let result = roaring::RoaringBitmap::from_iter(result); // TODO: Remove once we update roaring
Ok(result)
} else {
Err(points[0][0].as_external_error(FilterError::AttributeNotFilterable {
attribute: RESERVED_GEOJSON_FIELD_NAME,
filterable_patterns: filtered_matching_patterns(
filterable_attribute_rules,
&|features| features.is_filterable(),
),
}))?
}
}
}
}