Documentation
¶
Index ¶
- func ValidateEmbeddingBlob(blob []byte, dimension int) error
- type DB
- func (db *DB) DeleteCollection(ctx context.Context, name string) error
- func (db *DB) EmbeddingHealth(ctx context.Context, fingerprint string, dimension int, collection string) (EmbeddingHealth, error)
- func (db *DB) InsertEmbedding(ctx context.Context, chunkID int64, embedding []float32) error
- func (db *DB) Ping(ctx context.Context) error
- func (db *DB) RenameCollectionData(ctx context.Context, oldName, newName, path string) error
- func (db *DB) UpsertEmbedding(ctx context.Context, chunkID int64, embedding []float32, ...) error
- type EmbeddingHealth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateEmbeddingBlob ¶
ValidateEmbeddingBlob validates a little-endian float32 vector against its metadata dimension without allocating. It is shared by health checks and repair selection so both agree on what can safely participate in search.
Types ¶
type DB ¶
DB wraps a *sql.DB with qi-specific helpers.
func Open ¶
Open opens (or creates) the qi SQLite database at path, runs migrations, and configures WAL mode.
func (*DB) DeleteCollection ¶
DeleteCollection removes all data associated with the given collection name: chunk vectors, embeddings, chunks (FTS triggers keep chunks_fts in sync), documents, index runs, and the collections table row. Orphaned content blobs (not referenced by any remaining document) are also pruned.
func (*DB) EmbeddingHealth ¶
func (*DB) InsertEmbedding ¶
InsertEmbedding stores a vector embedding for a chunk as a raw BLOB. Retained for tests that only need a vector row without metadata.
func (*DB) RenameCollectionData ¶
RenameCollectionData merges indexed data from oldName into newName.
func (*DB) UpsertEmbedding ¶
func (db *DB) UpsertEmbedding(ctx context.Context, chunkID int64, embedding []float32, provider, model string, dimension int, fingerprint string) error
UpsertEmbedding stores a chunk's vector and its embedding metadata (provider, model, dimension, fingerprint) atomically in one transaction, so a vector can never persist without matching metadata (or vice versa).