Expand description
Hybrid spatial-vector search: spatial R-tree as a pre-filter for HNSW vector search.
Query pattern:
SELECT * FROM restaurants
WHERE ST_DWithin(location, geo_point(-73.98, 40.75), 500)
ORDER BY vector_distance(embedding, $query_vec) LIMIT 10Pipeline:
- R-tree range search → candidate entry IDs
- Convert entry IDs to RoaringBitmap
- Pass bitmap into vector search as pre-filter
- HNSW traversal skips entries not in bitmap
This is a unique NodeDB differentiator — PostGIS + pgvector can’t do this in a single index scan.
Structs§
- Spatial
PreFilter Result - Result of the spatial pre-filter phase.
Functions§
- bitmap_
contains - Check if an entry ID is set in a bitmap.
- ids_
to_ bitmap - Convert candidate entry IDs to a packed bitmap suitable for vector engine pre-filtering.
- spatial_
prefilter - Execute the spatial pre-filter phase.