creates an USV for a collection
(
ctx: Arc<AppContext>,
collection: &Collection,
quantization_bits: u8,
sample_threshold: usize,
)
| 282 | |
| 283 | /// creates an USV for a collection |
| 284 | pub async fn init_usv_index_for_collection( |
| 285 | ctx: Arc<AppContext>, |
| 286 | collection: &Collection, |
| 287 | quantization_bits: u8, |
| 288 | sample_threshold: usize, |
| 289 | ) -> Result<Arc<USVIndex>, WaCustomError> { |
| 290 | let collection_path: Arc<Path> = collection.get_path(); |
| 291 | let index_path = collection_path.join("usv_index"); |
| 292 | fs::create_dir_all(&index_path).map_err(|e| WaCustomError::FsError(e.to_string()))?; |
| 293 | |
| 294 | let index = Arc::new(USVIndex::new( |
| 295 | index_path.clone(), |
| 296 | quantization_bits, |
| 297 | sample_threshold, |
| 298 | )?); |
| 299 | |
| 300 | ctx.ain_env |
| 301 | .collections_map |
| 302 | .insert_usv_index(collection, index.clone())?; |
| 303 | Ok(index) |
| 304 | } |
no test coverage detected