Compute distance from a prepared query to the encoded vector at `id`. Returns `Ok(None)` when the id isn't in the sidecar (lost / not yet encoded); returns the distance otherwise.
(
&self,
prepared: &PreparedQuery,
id: u32,
)
| 134 | /// Returns `Ok(None)` when the id isn't in the sidecar (lost / not yet |
| 135 | /// encoded); returns the distance otherwise. |
| 136 | pub fn distance_prepared( |
| 137 | &self, |
| 138 | prepared: &PreparedQuery, |
| 139 | id: u32, |
| 140 | ) -> Result<Option<f32>, RerankError> { |
| 141 | match self.encoded.get(&id) { |
| 142 | None => Ok(None), |
| 143 | Some(bytes) => self.codec.distance_prepared(prepared, bytes).map(Some), |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | fn codec_name_to_u8(name: CodecName) -> u8 { |