Build a search hit from raw search result data. `id` is the bound surrogate when present, else the local node id (so headless rows still round-trip).
(
collection: Option<&VectorCollection>,
local_id: u32,
distance: f32,
)
| 20 | /// surrogate when present, else the local node id (so headless rows |
| 21 | /// still round-trip). |
| 22 | pub(super) fn build_search_hit( |
| 23 | collection: Option<&VectorCollection>, |
| 24 | local_id: u32, |
| 25 | distance: f32, |
| 26 | ) -> super::super::response_codec::VectorSearchHit { |
| 27 | let id = collection |
| 28 | .and_then(|c| c.get_surrogate(local_id)) |
| 29 | .map(|s| s.as_u32()) |
| 30 | .unwrap_or(local_id); |
| 31 | super::super::response_codec::VectorSearchHit { |
| 32 | id, |
| 33 | distance, |
| 34 | doc_id: None, |
| 35 | body: None, |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /// Translate a `SurrogateBitmap` (keyed by global surrogate IDs) into a |
| 40 | /// `RoaringBitmap` keyed by the collection's global vector IDs. |
no test coverage detected