open function
Implementation
Collection open(
String path, {
CollectionOption option = const CollectionOption(),
}) {
final raw = ZvecCollection.open(path);
final metadata = _readCollectionMetadata(path);
final schema =
metadata?.schema ??
CollectionSchema(
name: _defaultCollectionName(path),
fields: const <FieldSchema>[
FieldSchema('id', DataType.STRING),
FieldSchema('content', DataType.STRING, nullable: true),
FieldSchema('metadata', DataType.STRING, nullable: true),
FieldSchema('hash', DataType.STRING, nullable: true),
],
vectors: VectorSchema('vector', DataType.VECTOR_FP16, raw.dimension),
);
final resolvedOption = metadata?.option ?? option;
return Collection._(
path: path,
schema: schema,
option: resolvedOption,
raw: raw,
);
}