pub fn spatial_prefilter(
rtree: &RTree,
query_geometry: &Geometry,
distance_meters: Option<f64>,
exact_geometries: &dyn Fn(u64) -> Option<Geometry>,
governor: Option<&Arc<MemoryGovernor>>,
) -> SpatialPreFilterResultExpand description
Execute the spatial pre-filter phase.
- Compute search bounding box from query geometry + optional distance expansion
- R-tree range search → rough candidates
- For each candidate, load geometry and apply exact predicate
- Return filtered entry IDs
The caller (vector engine) uses the candidate IDs to build a RoaringBitmap that restricts HNSW graph traversal.
When governor is Some, the candidate_ids allocation is budgeted via
MemoryGovernor::reserve before the Vec::with_capacity. Budget pressure
is a backpressure signal; the allocation still proceeds on budget exhaustion.