tryLoadCachedIndex method
Try to load cached HNSW index.
Returns true if a previously built index exists (marker found). The actual index data is rebuilt from DB when rebuildIndex is called.
Usage pattern:
await service.init();
final hasCached = await service.tryLoadCachedIndex();
if (!hasCached || forceRebuild) {
await service.rebuildIndex();
}
Implementation
Future<bool> tryLoadCachedIndex() async {
final exists = await rust_rag.loadCollectionHnswIndex(
collectionId: collectionId,
basePath: _indexPath,
);
return exists;
}