first commit

This commit is contained in:
Tomas Dvorak
2026-02-22 10:42:17 +01:00
commit 55885a0e8f
239 changed files with 103690 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
// Package types provides shared types and interfaces.
package types
import "time"
// Document represents an indexed document.
type Document struct {
ID string `json:"id"`
Source string `json:"source"`
Type string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
URL string `json:"url,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Hash string `json:"hash"`
Timestamp time.Time `json:"timestamp"`
}
// Chunk represents a text chunk for indexing.
type Chunk struct {
ID string `json:"id"`
DocID string `json:"doc_id"`
Content string `json:"content"`
Vector []float32 `json:"vector,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Position int `json:"position"`
}
// SearchResult represents a search result.
type SearchResult struct {
ID string `json:"id"`
DocID string `json:"doc_id"`
Content string `json:"content"`
Score float64 `json:"score"`
Source string `json:"source"`
Metadata map[string]any `json:"metadata,omitempty"`
}
// Source represents a documentation source.
type Source struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
URL string `yaml:"url,omitempty"`
Repo string `yaml:"repo,omitempty"`
Branch string `yaml:"branch,omitempty"`
Path string `yaml:"path,omitempty"`
Include []string `yaml:"include,omitempty"`
Exclude []string `yaml:"exclude,omitempty"`
Schedule string `yaml:"schedule,omitempty"`
}
// Status represents index status.
type Status struct {
Healthy bool `json:"healthy"`
DocumentCount int `json:"document_count"`
ChunkCount int `json:"chunk_count"`
Dimension int `json:"dimension"`
LastUpdated time.Time `json:"last_updated"`
StorageBytes int64 `json:"storage_bytes"`
Sources []SourceStatus `json:"sources"`
}
// SourceStatus represents status of a single source.
type SourceStatus struct {
Name string `json:"name"`
Type string `json:"type"`
DocCount int `json:"doc_count"`
LastSync time.Time `json:"last_sync"`
Status string `json:"status"`
NextSync time.Time `json:"next_sync,omitempty"`
}