MCPcopy Create free account
hub / github.com/cosdata/cosdata / add_sparse_vector

Method add_sparse_vector

src/models/inverted_index.rs:310–327  ·  view source on GitHub ↗
(
        &self,
        vector: SparseVector,
        version: VersionNumber,
        values_upper_bound: f32,
    )

Source from the content-addressed store, hash-verified

308 /// Adds a sparse vector to the index.
309 #[allow(unused)]
310 pub fn add_sparse_vector(
311 &self,
312 vector: SparseVector,
313 version: VersionNumber,
314 values_upper_bound: f32,
315 ) -> Result<(), BufIoError> {
316 let vector_id = vector.vector_id;
317 vector
318 .entries
319 .par_iter()
320 .map(|(dim_index, value)| {
321 if *value != 0.0 {
322 return self.insert(*dim_index, *value, vector_id, version, values_upper_bound);
323 }
324 Ok(())
325 })
326 .collect()
327 }
328
329 pub fn serialize(&self) -> Result<(), BufIoError> {
330 let cursor = self.cache.dim_bufman.open_cursor()?;

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected