vectorIndexBuiltStateFromJson function
Reconstruct a built index from a JSON payload previously produced by
vectorIndexBuiltStateToJson. Dispatches on spec.kind.
Implementation
Object vectorIndexBuiltStateFromJson(
VectorIndexSpec spec,
Map<String, Object?> j,
) {
switch (spec.kind) {
case VectorIndexKind.flat:
return FlatIndex.fromJson(j);
case VectorIndexKind.hnsw:
return HnswIndex.fromJson(j);
case VectorIndexKind.ivf:
return IvfFlatIndex.fromJson(j);
case VectorIndexKind.lsh:
return LshIndex.fromJson(j);
case VectorIndexKind.pq:
return PqIndex.fromJson(j);
case VectorIndexKind.ivfPq:
return IvfPqIndex.fromJson(j);
}
}