Documentation
¶
Index ¶
- func CheckOllamaSetup(ollamaURL string) error
- func CleanupIndex(db *sql.DB, repoRoot string) error
- func FormatSearchResults(results []SearchResult, query string, maxResults int) string
- func GetRelevanceLabel(score float32) string
- func InitSearchDB(dbPath string) (*sql.DB, error)
- func PrintSearchHelp()
- func UpdateIndex(db *sql.DB, cfg *SearchConfig, repoRoot string, excludedPaths []string) error
- func ValidateIndex(db *sql.DB, repoRoot string) error
- type FileInfo
- type IndexStats
- type OllamaEmbeddingRequest
- type OllamaEmbeddingResponse
- type SearchCommands
- func (sc *SearchCommands) Close() error
- func (sc *SearchCommands) HandleReindex(excludedPaths []string, showProgress bool) error
- func (sc *SearchCommands) HandleSearchCleanup() error
- func (sc *SearchCommands) HandleSearchStatus() error
- func (sc *SearchCommands) HandleSearchUpdate(excludedPaths []string) error
- func (sc *SearchCommands) HandleSearchValidate() error
- func (sc *SearchCommands) InitializeSearchIndex(excludedPaths []string, showProgress bool) error
- func (sc *SearchCommands) Search(query string) (string, error)
- type SearchConfig
- type SearchEngine
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckOllamaSetup ¶
CheckOllamaSetup verifies Ollama is available
func CleanupIndex ¶
CleanupIndex removes entries for non-existent files
func FormatSearchResults ¶
func FormatSearchResults(results []SearchResult, query string, maxResults int) string
FormatSearchResults formats search results for display
func GetRelevanceLabel ¶
GetRelevanceLabel returns a human-readable relevance label based on score
func InitSearchDB ¶
InitSearchDB initializes the SQLite database for storing embeddings
func PrintSearchHelp ¶
func PrintSearchHelp()
PrintSearchHelp prints help information for search commands
func UpdateIndex ¶
UpdateIndex performs incremental update of the index
Types ¶
type FileInfo ¶
type FileInfo struct {
FilePath string
ContentHash string
Embedding []float32
LastModified int64
FileSize int64
IndexedAt int64
}
FileInfo holds metadata about indexed files
type IndexStats ¶
type IndexStats struct {
TotalFiles int
IndexedFiles int
SkippedFiles int
ErrorFiles int
StartTime time.Time
EndTime time.Time
BytesIndexed int64
}
IndexStats holds statistics about indexing operation
func IndexRepository ¶
func IndexRepository(db *sql.DB, cfg *SearchConfig, repoRoot string, excludedPaths []string, showProgress bool, reindexAll bool) (*IndexStats, error)
IndexRepository walks through repository and indexes files
type OllamaEmbeddingRequest ¶
OllamaEmbeddingRequest represents the request to Ollama API
type OllamaEmbeddingResponse ¶
type OllamaEmbeddingResponse struct {
Embedding []float64 `json:"embedding"`
}
OllamaEmbeddingResponse represents the response from Ollama API
type SearchCommands ¶
type SearchCommands struct {
// contains filtered or unexported fields
}
SearchCommands handles search-related CLI commands
func NewSearchCommands ¶
func NewSearchCommands(cfg *SearchConfig, repoRoot string) (*SearchCommands, error)
NewSearchCommands creates a new search commands handler
func (*SearchCommands) Close ¶
func (sc *SearchCommands) Close() error
Close closes the search commands handler
func (*SearchCommands) HandleReindex ¶
func (sc *SearchCommands) HandleReindex(excludedPaths []string, showProgress bool) error
HandleReindex handles the reindex command
func (*SearchCommands) HandleSearchCleanup ¶
func (sc *SearchCommands) HandleSearchCleanup() error
HandleSearchCleanup handles the search cleanup command
func (*SearchCommands) HandleSearchStatus ¶
func (sc *SearchCommands) HandleSearchStatus() error
HandleSearchStatus handles the search status command
func (*SearchCommands) HandleSearchUpdate ¶
func (sc *SearchCommands) HandleSearchUpdate(excludedPaths []string) error
HandleSearchUpdate handles the search update command
func (*SearchCommands) HandleSearchValidate ¶
func (sc *SearchCommands) HandleSearchValidate() error
HandleSearchValidate handles the search validate command
func (*SearchCommands) InitializeSearchIndex ¶
func (sc *SearchCommands) InitializeSearchIndex(excludedPaths []string, showProgress bool) error
InitializeSearchIndex creates initial index if needed
type SearchConfig ¶
type SearchConfig struct {
Enabled bool `yaml:"enabled"`
VectorDBPath string `yaml:"vector_db_path"`
EmbeddingModel string `yaml:"embedding_model"`
MaxResults int `yaml:"max_results"`
MinSimilarityScore float64 `yaml:"min_similarity_score"`
MaxPreviewLength int `yaml:"max_preview_length"`
OllamaURL string `yaml:"ollama_url"`
IndexExtensions []string `yaml:"index_extensions"`
MaxFileSize int64 `yaml:"max_file_size"`
}
SearchConfig holds search-related configuration
type SearchEngine ¶
type SearchEngine struct {
// contains filtered or unexported fields
}
SearchEngine provides semantic search functionality
func NewSearchEngine ¶
func NewSearchEngine(cfg *SearchConfig, repoRoot string) (*SearchEngine, error)
NewSearchEngine creates a new search engine instance
func (*SearchEngine) Close ¶
func (se *SearchEngine) Close() error
Close closes the search engine and its resources
func (*SearchEngine) GetConfig ¶
func (se *SearchEngine) GetConfig() *SearchConfig
GetConfig returns the search configuration
func (*SearchEngine) GetDB ¶
func (se *SearchEngine) GetDB() *sql.DB
GetDB returns the underlying database connection
func (*SearchEngine) GetRepoRoot ¶
func (se *SearchEngine) GetRepoRoot() string
GetRepoRoot returns the repository root path
func (*SearchEngine) Search ¶
func (se *SearchEngine) Search(query string) ([]SearchResult, error)
Search performs a semantic search for the given query