Inserts a value into the index at the specified dimension index. Finds the quantized value and pushes the vec_Id in array at index = quantized_value
(
&self,
value: f32,
vector_id: u32,
cache: &InvertedIndexCache,
version: VersionNumber,
values_upper_bound: f32,
)
| 174 | /// Inserts a value into the index at the specified dimension index. |
| 175 | /// Finds the quantized value and pushes the vec_Id in array at index = quantized_value |
| 176 | pub fn insert( |
| 177 | &self, |
| 178 | value: f32, |
| 179 | vector_id: u32, |
| 180 | cache: &InvertedIndexCache, |
| 181 | version: VersionNumber, |
| 182 | values_upper_bound: f32, |
| 183 | ) -> Result<(), BufIoError> { |
| 184 | let quantized_value = self.quantize(value, values_upper_bound); |
| 185 | unsafe { &*self.data } |
| 186 | .try_get_data(cache)? |
| 187 | .map |
| 188 | .modify_or_insert( |
| 189 | quantized_value, |
| 190 | |list| { |
| 191 | list.push(version, vector_id); |
| 192 | }, |
| 193 | || { |
| 194 | let mut pool = VersionedVec::new(version); |
| 195 | pool.push(version, vector_id); |
| 196 | pool |
| 197 | }, |
| 198 | ); |
| 199 | self.is_dirty.store(true, Ordering::Release); |
| 200 | Ok(()) |
| 201 | } |
| 202 | |
| 203 | /// Delete a value from the index at the specified dimension index. |
| 204 | /// Finds the quantized value and (soft) deletes the vec_id |
no test coverage detected