(
codec: &crate::quantize::sq8::Sq8Codec,
query: &[f32],
encoded: &[u8],
metric: DistanceMetric,
)
| 21 | /// asymmetric distance. |
| 22 | #[inline] |
| 23 | fn sq8_score( |
| 24 | codec: &crate::quantize::sq8::Sq8Codec, |
| 25 | query: &[f32], |
| 26 | encoded: &[u8], |
| 27 | metric: DistanceMetric, |
| 28 | ) -> f32 { |
| 29 | match metric { |
| 30 | DistanceMetric::Cosine => codec.asymmetric_cosine(query, encoded), |
| 31 | DistanceMetric::InnerProduct => codec.asymmetric_ip(query, encoded), |
| 32 | // L2 (and all other metrics that don't have a specialized asymmetric |
| 33 | // form yet) fall back to squared L2 — correct for ordering when the |
| 34 | // metric is L2 and a reasonable proxy otherwise since we rerank with |
| 35 | // exact FP32 below. |
| 36 | _ => codec.asymmetric_l2(query, encoded), |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | /// Candidate-generation + rerank for a sealed segment that has a quantized |
| 41 | /// codec attached. Generates a widened candidate pool via HNSW, re-scores |
no test coverage detected