diff --git a/collection.go b/collection.go index 8a0bdcb..4dbd7a4 100644 --- a/collection.go +++ b/collection.go @@ -417,7 +417,7 @@ func (c *Collection) Query(ctx context.Context, queryText string, nResults int, // QueryWithOptions performs an exhaustive nearest neighbor search on the collection. // -// - options: The options for the query. See QueryOptions for more information. +// - options: The options for the query. See [QueryOptions] for more information. func (c *Collection) QueryWithOptions(ctx context.Context, options QueryOptions) ([]Result, error) { if options.QueryText == "" && len(options.QueryEmbedding) == 0 { return nil, errors.New("QueryText and QueryEmbedding options are empty") diff --git a/db.go b/db.go index 001271e..210e00e 100644 --- a/db.go +++ b/db.go @@ -62,8 +62,9 @@ func NewDB() *DB { // will make this configurable (encoding, async writes, WAL-based writes, etc.). // // In addition to persistence for each added collection and document you can use -// [DB.Export] and [DB.Import] to export and import the entire DB to/from a file, -// which also works for the pure in-memory DB. +// [DB.ExportToFile] / [DB.ExportToWriter] and [DB.ImportFromFile] / +// [DB.ImportFromReader] to export and import the entire DB to/from a file or +// writer/reader, which also works for the pure in-memory DB. func NewPersistentDB(path string, compress bool) (*DB, error) { if path == "" { path = "./chromem-go" @@ -284,6 +285,9 @@ func (db *DB) ImportFromFile(filePath string, encryptionKey string, collections // This works for both the in-memory and persistent DBs. // Existing collections are overwritten. // If the writer has to be closed, it's the caller's responsibility. +// This can be used to import DBs from object storage like S3. See +// https://github.com/philippgille/chromem-go/tree/main/examples/s3-export-import +// for an example. // // - reader: An implementation of [io.ReadSeeker] // - encryptionKey: Optional, must be 32 bytes long if provided @@ -432,6 +436,9 @@ func (db *DB) ExportToFile(filePath string, compress bool, encryptionKey string, // optionally compressed with flate (as gzip) and optionally encrypted with AES-GCM. // This works for both the in-memory and persistent DBs. // If the writer has to be closed, it's the caller's responsibility. +// This can be used to export DBs to object storage like S3. See +// https://github.com/philippgille/chromem-go/tree/main/examples/s3-export-import +// for an example. // // - writer: An implementation of [io.Writer] // - compress: Optional. Compresses as gzip if true. @@ -509,7 +516,7 @@ func (db *DB) CreateCollection(name string, metadata map[string]string, embeddin // ListCollections returns all collections in the DB, mapping name->Collection. // The returned map is a copy of the internal map, so it's safe to directly modify // the map itself. Direct modifications of the map won't reflect on the DB's map. -// To do that use the DB's methods like CreateCollection() and DeleteCollection(). +// To do that use the DB's methods like [DB.CreateCollection] and [DB.DeleteCollection]. // The map is not an entirely deep clone, so the collections themselves are still // the original ones. Any methods on the collections like Add() for adding documents // will be reflected on the DB's collections and are concurrency-safe.