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

Method load_dense_index

src/models/collection_cache.rs:192–209  ·  view source on GitHub ↗

Loads the dense vector index for a collection

(&self, name: &str)

Source from the content-addressed store, hash-verified

190
191 // Loads the dense vector index for a collection
192 fn load_dense_index(&self, name: &str) -> Result<Option<Arc<HNSWIndex>>, WaCustomError> {
193 info!("Loading dense index for collection: {}", name);
194
195 // First check if the index exists in the AppEnv
196 if let Some(index) = self
197 .app_env
198 .collections_map
199 .get_collection(name)
200 .and_then(|collection| collection.get_hnsw_index())
201 {
202 info!("Found HNSW index for '{}' in memory", name);
203 return Ok(Some(index));
204 }
205
206 // If not in memory, we would load it from disk
207 info!("No HNSW index found for '{}'", name);
208 Ok(None)
209 }
210
211 // Loads the inverted index for a collection
212 fn load_inverted_index(&self, name: &str) -> Result<Option<Arc<InvertedIndex>>, WaCustomError> {

Callers 1

load_collectionMethod · 0.80

Calls 2

get_collectionMethod · 0.80
get_hnsw_indexMethod · 0.80

Tested by

no test coverage detected