Documentation
¶
Index ¶
- func SanitizeCollectionName(path string) string
- type Chunk
- type Document
- type EmbeddingCache
- type FileStats
- type GOBStore
- func (s *GOBStore) Close() error
- func (s *GOBStore) DeleteByFile(ctx context.Context, filePath string) error
- func (s *GOBStore) DeleteDocument(ctx context.Context, filePath string) error
- func (s *GOBStore) GetAllChunks(ctx context.Context) ([]Chunk, error)
- func (s *GOBStore) GetChunksForFile(ctx context.Context, filePath string) ([]Chunk, error)
- func (s *GOBStore) GetDocument(ctx context.Context, filePath string) (*Document, error)
- func (s *GOBStore) GetStats(ctx context.Context) (*IndexStats, error)
- func (s *GOBStore) ListDocuments(ctx context.Context) ([]string, error)
- func (s *GOBStore) ListFilesWithStats(ctx context.Context) ([]FileStats, error)
- func (s *GOBStore) Load(ctx context.Context) error
- func (s *GOBStore) LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
- func (s *GOBStore) Persist(ctx context.Context) error
- func (s *GOBStore) SaveChunks(ctx context.Context, chunks []Chunk) error
- func (s *GOBStore) SaveDocument(ctx context.Context, doc Document) error
- func (s *GOBStore) Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
- func (s *GOBStore) Stats() (numDocs int, numChunks int)
- type IndexStats
- type PostgresStore
- func (s *PostgresStore) Close() error
- func (s *PostgresStore) DeleteByFile(ctx context.Context, filePath string) error
- func (s *PostgresStore) DeleteDocument(ctx context.Context, filePath string) error
- func (s *PostgresStore) GetAllChunks(ctx context.Context) ([]Chunk, error)
- func (s *PostgresStore) GetChunksForFile(ctx context.Context, filePath string) ([]Chunk, error)
- func (s *PostgresStore) GetDocument(ctx context.Context, filePath string) (*Document, error)
- func (s *PostgresStore) GetStats(ctx context.Context) (*IndexStats, error)
- func (s *PostgresStore) ListDocuments(ctx context.Context) ([]string, error)
- func (s *PostgresStore) ListFilesWithStats(ctx context.Context) ([]FileStats, error)
- func (s *PostgresStore) Load(ctx context.Context) error
- func (s *PostgresStore) LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
- func (s *PostgresStore) Persist(ctx context.Context) error
- func (s *PostgresStore) SaveChunks(ctx context.Context, chunks []Chunk) error
- func (s *PostgresStore) SaveDocument(ctx context.Context, doc Document) error
- func (s *PostgresStore) Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
- type QdrantStore
- func (s *QdrantStore) Close() error
- func (s *QdrantStore) DeleteByFile(ctx context.Context, filePath string) error
- func (s *QdrantStore) DeleteDocument(ctx context.Context, filePath string) error
- func (s *QdrantStore) GetAllChunks(ctx context.Context) ([]Chunk, error)
- func (s *QdrantStore) GetChunksForFile(ctx context.Context, filePath string) ([]Chunk, error)
- func (s *QdrantStore) GetDocument(ctx context.Context, filePath string) (*Document, error)
- func (s *QdrantStore) GetStats(ctx context.Context) (*IndexStats, error)
- func (s *QdrantStore) ListDocuments(ctx context.Context) ([]string, error)
- func (s *QdrantStore) ListFilesWithStats(ctx context.Context) ([]FileStats, error)
- func (s *QdrantStore) Load(ctx context.Context) error
- func (s *QdrantStore) LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
- func (s *QdrantStore) Persist(ctx context.Context) error
- func (s *QdrantStore) SaveChunks(ctx context.Context, chunks []Chunk) error
- func (s *QdrantStore) SaveDocument(ctx context.Context, doc Document) error
- func (s *QdrantStore) Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
- type SearchOptions
- type SearchResult
- type VectorStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeCollectionName ¶ added in v0.18.0
Types ¶
type Chunk ¶
type Chunk struct {
ID string `json:"id"`
FilePath string `json:"file_path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Content string `json:"content"`
Vector []float32 `json:"vector"`
Hash string `json:"hash"`
ContentHash string `json:"content_hash"` // SHA256 of raw content (path-independent)
UpdatedAt time.Time `json:"updated_at"`
}
Chunk represents a piece of code with its vector embedding
type Document ¶
type Document struct {
Path string `json:"path"`
Hash string `json:"hash"`
ModTime time.Time `json:"mod_time"`
ChunkIDs []string `json:"chunk_ids"`
}
Document represents a file with its chunks
type EmbeddingCache ¶ added in v0.28.0
type EmbeddingCache interface {
// LookupByContentHash returns the embedding vector for the given content hash.
// Returns (vector, true, nil) if found, (nil, false, nil) if not found.
LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
}
EmbeddingCache is an optional interface that VectorStore implementations can provide to enable content-addressed embedding deduplication. When a store implements this interface, the indexer will look up existing embeddings by content hash before calling the embedder, avoiding redundant API calls for identical content (e.g., across git worktrees).
type FileStats ¶ added in v0.2.0
type FileStats struct {
Path string `json:"path"`
ChunkCount int `json:"chunk_count"`
ModTime time.Time `json:"mod_time"`
}
FileStats contains statistics for a single file
type GOBStore ¶
type GOBStore struct {
// contains filtered or unexported fields
}
func NewGOBStore ¶
func (*GOBStore) DeleteByFile ¶
func (*GOBStore) DeleteDocument ¶
func (*GOBStore) GetAllChunks ¶ added in v0.3.0
func (*GOBStore) GetChunksForFile ¶ added in v0.2.0
func (*GOBStore) GetDocument ¶
func (*GOBStore) GetStats ¶ added in v0.2.0
func (s *GOBStore) GetStats(ctx context.Context) (*IndexStats, error)
func (*GOBStore) ListDocuments ¶
func (*GOBStore) ListFilesWithStats ¶ added in v0.2.0
func (*GOBStore) LookupByContentHash ¶ added in v0.28.0
func (s *GOBStore) LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
LookupByContentHash searches in-memory chunks for a matching content hash.
func (*GOBStore) SaveChunks ¶
func (*GOBStore) SaveDocument ¶
func (*GOBStore) Search ¶
func (s *GOBStore) Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
type IndexStats ¶ added in v0.2.0
type IndexStats struct {
TotalFiles int `json:"total_files"`
TotalChunks int `json:"total_chunks"`
IndexSize int64 `json:"index_size"` // bytes
LastUpdated time.Time `json:"last_updated"`
}
IndexStats contains statistics about the index
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
func NewPostgresStore ¶
func (*PostgresStore) Close ¶
func (s *PostgresStore) Close() error
func (*PostgresStore) DeleteByFile ¶
func (s *PostgresStore) DeleteByFile(ctx context.Context, filePath string) error
func (*PostgresStore) DeleteDocument ¶
func (s *PostgresStore) DeleteDocument(ctx context.Context, filePath string) error
func (*PostgresStore) GetAllChunks ¶ added in v0.3.0
func (s *PostgresStore) GetAllChunks(ctx context.Context) ([]Chunk, error)
func (*PostgresStore) GetChunksForFile ¶ added in v0.2.0
func (*PostgresStore) GetDocument ¶
func (*PostgresStore) GetStats ¶ added in v0.2.0
func (s *PostgresStore) GetStats(ctx context.Context) (*IndexStats, error)
func (*PostgresStore) ListDocuments ¶
func (s *PostgresStore) ListDocuments(ctx context.Context) ([]string, error)
func (*PostgresStore) ListFilesWithStats ¶ added in v0.2.0
func (s *PostgresStore) ListFilesWithStats(ctx context.Context) ([]FileStats, error)
func (*PostgresStore) LookupByContentHash ¶ added in v0.28.0
func (s *PostgresStore) LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
LookupByContentHash queries the chunks table for a matching content hash and returns the vector.
func (*PostgresStore) SaveChunks ¶
func (s *PostgresStore) SaveChunks(ctx context.Context, chunks []Chunk) error
func (*PostgresStore) SaveDocument ¶
func (s *PostgresStore) SaveDocument(ctx context.Context, doc Document) error
func (*PostgresStore) Search ¶
func (s *PostgresStore) Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
type QdrantStore ¶ added in v0.18.0
type QdrantStore struct {
// contains filtered or unexported fields
}
func NewQdrantStore ¶ added in v0.18.0
func (*QdrantStore) Close ¶ added in v0.18.0
func (s *QdrantStore) Close() error
func (*QdrantStore) DeleteByFile ¶ added in v0.18.0
func (s *QdrantStore) DeleteByFile(ctx context.Context, filePath string) error
func (*QdrantStore) DeleteDocument ¶ added in v0.18.0
func (s *QdrantStore) DeleteDocument(ctx context.Context, filePath string) error
func (*QdrantStore) GetAllChunks ¶ added in v0.18.0
func (s *QdrantStore) GetAllChunks(ctx context.Context) ([]Chunk, error)
func (*QdrantStore) GetChunksForFile ¶ added in v0.18.0
func (*QdrantStore) GetDocument ¶ added in v0.18.0
func (*QdrantStore) GetStats ¶ added in v0.18.0
func (s *QdrantStore) GetStats(ctx context.Context) (*IndexStats, error)
func (*QdrantStore) ListDocuments ¶ added in v0.18.0
func (s *QdrantStore) ListDocuments(ctx context.Context) ([]string, error)
func (*QdrantStore) ListFilesWithStats ¶ added in v0.18.0
func (s *QdrantStore) ListFilesWithStats(ctx context.Context) ([]FileStats, error)
func (*QdrantStore) LookupByContentHash ¶ added in v0.28.0
func (s *QdrantStore) LookupByContentHash(ctx context.Context, contentHash string) ([]float32, bool, error)
LookupByContentHash searches Qdrant for a point matching the content hash.
func (*QdrantStore) Persist ¶ added in v0.18.0
func (s *QdrantStore) Persist(ctx context.Context) error
func (*QdrantStore) SaveChunks ¶ added in v0.18.0
func (s *QdrantStore) SaveChunks(ctx context.Context, chunks []Chunk) error
func (*QdrantStore) SaveDocument ¶ added in v0.18.0
func (s *QdrantStore) SaveDocument(ctx context.Context, doc Document) error
func (*QdrantStore) Search ¶ added in v0.18.0
func (s *QdrantStore) Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
type SearchOptions ¶ added in v0.33.0
type SearchOptions struct {
PathPrefix string
}
SearchOptions contains optional filters for vector search queries.
type SearchResult ¶
SearchResult represents a search match with its relevance score
type VectorStore ¶
type VectorStore interface {
// SaveChunks stores multiple chunks atomically
SaveChunks(ctx context.Context, chunks []Chunk) error
// DeleteByFile removes all chunks for a given file path
DeleteByFile(ctx context.Context, filePath string) error
// Search finds the most similar chunks to a query vector
Search(ctx context.Context, queryVector []float32, limit int, opts SearchOptions) ([]SearchResult, error)
// GetDocument retrieves document metadata by path
GetDocument(ctx context.Context, filePath string) (*Document, error)
// SaveDocument stores document metadata
SaveDocument(ctx context.Context, doc Document) error
// DeleteDocument removes document metadata
DeleteDocument(ctx context.Context, filePath string) error
// ListDocuments returns all indexed document paths
ListDocuments(ctx context.Context) ([]string, error)
// Load reads the store from persistent storage
Load(ctx context.Context) error
// Persist writes the store to persistent storage
Persist(ctx context.Context) error
// Close cleanly shuts down the store
Close() error
// GetStats returns index statistics
GetStats(ctx context.Context) (*IndexStats, error)
// ListFilesWithStats returns all files with their chunk counts
ListFilesWithStats(ctx context.Context) ([]FileStats, error)
// GetChunksForFile returns all chunks for a specific file
GetChunksForFile(ctx context.Context, filePath string) ([]Chunk, error)
// GetAllChunks returns all chunks in the store (used for text search)
GetAllChunks(ctx context.Context) ([]Chunk, error)
}
VectorStore defines the interface for vector storage backends