Documentation
¶
Index ¶
- Constants
- func Execute() error
- type BedSearchOptions
- type BinaryHeader
- type BinarySearchResult
- type CAGRABedSearcher
- type ChunkedMatch
- type ChunkedSearcher
- type Config
- type CrawlOptions
- type CrawlStats
- type Crawler
- type Document
- type Embedder
- func (e *Embedder) Close() error
- func (e *Embedder) GetModel() *gobed.EmbeddingModel
- func (e *Embedder) IsGPUAvailable() bool
- func (e *Embedder) ProcessBatch(texts []string) ([][]float32, error)
- func (e *Embedder) ProcessFiles(files <-chan *FileInfo, options EmbeddingOptions) (<-chan *EmbeddingResult, error)
- func (e *Embedder) Stats() map[string]interface{}
- type EmbeddingIndex
- func (idx *EmbeddingIndex) AddFile(fileInfo *FileInfo, embeddings [][]float32) error
- func (idx *EmbeddingIndex) Save() error
- func (idx *EmbeddingIndex) Search(query string, model *gobed.EmbeddingModel, options SearchOptions) ([]*SearchResult, error)
- func (idx *EmbeddingIndex) Stats() map[string]interface{}
- type EmbeddingOptions
- type EmbeddingResult
- type EnhancedIgnoreFilter
- type FastIndexer
- func (fi *FastIndexer) Clear()
- func (fi *FastIndexer) GetEngine() *Int8SearchEngine
- func (fi *FastIndexer) IndexDirectory(dir string, verbose bool) error
- func (fi *FastIndexer) Search(query string, topK int, threshold float32) ([]SearchMatch, error)
- func (fi *FastIndexer) Stats() map[string]interface{}
- type FastIndexerConfig
- type FileEntry
- type FileInfo
- type FileResultGroup
- type FileType
- type FilterOption
- type GPUChunkedSearcher
- type GPUIndexData
- type GitignoreRule
- type HighlightRange
- type IgnoreFilter
- type IndexConfig
- type IndexOptions
- type IndexStatus
- type Indexer
- func (idx *Indexer) Close() error
- func (idx *Indexer) EstimateIndexSize(path string, options IndexOptions) (int64, error)
- func (idx *Indexer) Index(options IndexOptions) error
- func (idx *Indexer) Stats() map[string]interface{}
- func (idx *Indexer) UpdateIndex(changedFiles []string, options IndexOptions) error
- type Int8SearchEngine
- type LineEntry
- type OptimizedSearchEngine
- func (e *OptimizedSearchEngine) AddDocument(doc Document, embedding *gobed.Int8Result512)
- func (e *OptimizedSearchEngine) AddDocumentFloat32(doc Document, embedding []float32)
- func (e *OptimizedSearchEngine) BatchAddDocuments(docs []Document, numWorkers int) error
- func (e *OptimizedSearchEngine) Clear()
- func (e *OptimizedSearchEngine) NumDocuments() int
- func (e *OptimizedSearchEngine) Search(query string, topK int, threshold float32) ([]SearchMatch, error)
- func (e *OptimizedSearchEngine) UseInt8() bool
- type OutputFormatter
- func (f *OutputFormatter) FormatError(err error) string
- func (f *OutputFormatter) FormatProgressBar(current, total int64, rate float64, eta string) string
- func (f *OutputFormatter) FormatSearchResults(results []*SearchResult, query string) string
- func (f *OutputFormatter) FormatStatistics(stats map[string]interface{}) string
- func (f *OutputFormatter) FormatSuccess(message string) string
- func (f *OutputFormatter) FormatWarning(message string) string
- func (f *OutputFormatter) SetContextLines(lines int)
- func (f *OutputFormatter) SetLineNumbers(show bool)
- type ProcessedQuery
- type QueryProcessor
- type QueryType
- type SearchMatch
- type SearchOptions
- type SearchResult
- type Searcher
- type SimpleBedSearcher
- type SimpleSearchEngine
Constants ¶
const ( MaxLineLength = 200 // Maximum chars to show per line MaxContextChars = 80 // Chars to show around match MaxFileSize = 10 << 20 // 10MB default max file size ChunkOverlap = 50 // Overlap between chunks for context )
const ( MagicNumber = 0xBED12345 HeaderSize = 64 // bytes )
Binary format constants
const DefaultMaxFileSize = 10 * 1024 * 1024
DefaultMaxFileSize is 10MB
const IndexVersion = 1
IndexVersion defines the current index format version
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BedSearchOptions ¶
type BedSearchOptions struct {
Query string
Limit int
Context int
Threshold float32
NoIndex bool
ForceIndex bool
SearchBinaries bool
Progressive bool
UseGPU bool
Verbose bool
ColorMode string
}
BedSearchOptions configures search behavior
type BinaryHeader ¶
type BinaryHeader struct {
Magic uint32
Version uint32
HeaderSize uint32
IndexSize uint64
NumFiles uint32
NumLines uint32
NumEmbeddings uint32
Compression uint8 // 0=none, 1=gzip
Reserved [35]byte
}
BinaryHeader represents the binary index file header
type BinarySearchResult ¶
type BinarySearchResult struct {
FilePath string
HasMatch bool
Confidence float32
FileSize int64
Note string
}
BinarySearchResult represents a search result in a binary file
func ProcessBinaryFile ¶
func ProcessBinaryFile(path string, query []float32, model interface{}) *BinarySearchResult
ProcessBinaryFile handles binary file searching
type CAGRABedSearcher ¶
type CAGRABedSearcher struct{}
func NewCAGRABedSearcher ¶
func NewCAGRABedSearcher() (*CAGRABedSearcher, error)
func (*CAGRABedSearcher) Close ¶
func (c *CAGRABedSearcher) Close() error
func (*CAGRABedSearcher) Search ¶
func (c *CAGRABedSearcher) Search(options BedSearchOptions) error
type ChunkedMatch ¶
type ChunkedMatch struct {
Path string
LineNumber int
Column int
Preview string // Limited preview with ... ellipsis
FullMatch bool // Whether the entire match is shown
}
ChunkedMatch represents a search result with limited context
type ChunkedSearcher ¶
type ChunkedSearcher struct {
// contains filtered or unexported fields
}
ChunkedSearcher performs token-friendly searches
func NewChunkedSearcher ¶
func NewChunkedSearcher() (*ChunkedSearcher, error)
NewChunkedSearcher creates a new chunked searcher
func (*ChunkedSearcher) PrintResults ¶
func (cs *ChunkedSearcher) PrintResults(results []ChunkedMatch, useColor bool)
PrintResults displays results in ripgrep-like format
func (*ChunkedSearcher) SearchDirectory ¶
func (cs *ChunkedSearcher) SearchDirectory(dir, pattern string, caseSensitive bool) ([]ChunkedMatch, error)
SearchDirectory searches for pattern in directory with chunked output
type Config ¶
type Config struct {
// Index settings
IndexPath string `json:"index_path"`
CacheDir string `json:"cache_dir"`
MaxFileSize int64 `json:"max_file_size"` // bytes
MaxFiles int `json:"max_files"`
// Search settings
DefaultLimit int `json:"default_limit"`
DefaultContext int `json:"default_context"`
DefaultThreshold float32 `json:"default_threshold"`
ColorMode string `json:"color_mode"`
// Performance settings
UseGPU bool `json:"use_gpu"`
GPUDeviceID int `json:"gpu_device_id"`
WorkerThreads int `json:"worker_threads"`
BatchSize int `json:"batch_size"`
AsyncIndexing bool `json:"async_indexing"`
// File filtering
RespectGitignore bool `json:"respect_gitignore"`
IgnorePatterns []string `json:"ignore_patterns"`
IncludeExtensions []string `json:"include_extensions"`
ExcludeExtensions []string `json:"exclude_extensions"`
// Advanced
EmbeddingModel string `json:"embedding_model"`
IndexFormat string `json:"index_format"`
CompressionLevel int `json:"compression_level"`
}
Config holds bed configuration
func LoadConfig ¶
LoadConfig loads configuration from ~/.bed/config.json
type CrawlOptions ¶
type CrawlOptions struct {
MaxWorkers int
BufferSize int
MaxFileSize int64
IncludeContent bool
WatchMode bool
Recursive bool
FollowSymlinks bool
}
CrawlOptions configures the crawling behavior
func DefaultCrawlOptions ¶
func DefaultCrawlOptions() CrawlOptions
DefaultCrawlOptions returns sensible defaults
type CrawlStats ¶
type CrawlStats struct {
FilesFound int64
FilesProcessed int64
BytesProcessed int64
LinesProcessed int64
Errors int64
StartTime time.Time
EndTime time.Time
ElapsedTime time.Duration
}
CrawlStats tracks crawling statistics
type Crawler ¶
type Crawler struct {
// contains filtered or unexported fields
}
Crawler handles async filesystem crawling with ignore pattern filtering
func NewCrawler ¶
NewCrawler creates a new filesystem crawler
func (*Crawler) Crawl ¶
func (c *Crawler) Crawl(options CrawlOptions) (<-chan *FileInfo, <-chan error, error)
Crawl starts the async crawling process
func (*Crawler) Stats ¶
func (c *Crawler) Stats() CrawlStats
Stats returns current crawling statistics
type Embedder ¶
type Embedder struct {
// contains filtered or unexported fields
}
Embedder handles GPU-accelerated embedding generation
func NewEmbedder ¶
NewEmbedder creates a new embedder with GPU support
func (*Embedder) GetModel ¶
func (e *Embedder) GetModel() *gobed.EmbeddingModel
GetModel returns the underlying embedding model
func (*Embedder) IsGPUAvailable ¶
IsGPUAvailable checks if GPU acceleration is available
func (*Embedder) ProcessBatch ¶
ProcessBatch processes a batch of texts and returns embeddings
func (*Embedder) ProcessFiles ¶
func (e *Embedder) ProcessFiles(files <-chan *FileInfo, options EmbeddingOptions) (<-chan *EmbeddingResult, error)
ProcessFiles processes files and generates embeddings
type EmbeddingIndex ¶
type EmbeddingIndex struct {
// Metadata
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
BasePath string `json:"base_path"`
TotalFiles int `json:"total_files"`
TotalLines int `json:"total_lines"`
IndexSize int64 `json:"index_size"`
// Configuration used to build this index
Config IndexConfig `json:"config"`
// File tracking
Files map[string]*FileEntry `json:"files"`
Lines []*LineEntry `json:"lines"`
// Embeddings and search structures
FileEmbeddings map[string][]float32 `json:"file_embeddings"`
LineEmbeddings [][]float32 `json:"line_embeddings"`
// Fast lookup structures
PathToID map[string]int `json:"path_to_id"`
IDToPath map[int]string `json:"id_to_path"`
// GPU-optimized structures (when GPU is available)
GPUIndex *GPUIndexData `json:"gpu_index,omitempty"`
// contains filtered or unexported fields
}
EmbeddingIndex represents the main semantic index
func LoadEmbeddingIndex ¶
func LoadEmbeddingIndex(indexPath string) (*EmbeddingIndex, error)
LoadEmbeddingIndex loads an existing index from disk
func NewEmbeddingIndex ¶
func NewEmbeddingIndex(basePath, indexPath string, config IndexConfig) *EmbeddingIndex
NewEmbeddingIndex creates a new embedding index
func (*EmbeddingIndex) AddFile ¶
func (idx *EmbeddingIndex) AddFile(fileInfo *FileInfo, embeddings [][]float32) error
AddFile adds a file to the index
func (*EmbeddingIndex) Save ¶
func (idx *EmbeddingIndex) Save() error
Save persists the index to disk
func (*EmbeddingIndex) Search ¶
func (idx *EmbeddingIndex) Search(query string, model *gobed.EmbeddingModel, options SearchOptions) ([]*SearchResult, error)
Search performs semantic search in the index
func (*EmbeddingIndex) Stats ¶
func (idx *EmbeddingIndex) Stats() map[string]interface{}
Stats returns index statistics
type EmbeddingOptions ¶
type EmbeddingOptions struct {
UseGPU bool
BatchSize int
MaxWorkers int
ShowProgress bool
LineLevel bool
FileLevel bool
ContextSize int
}
EmbeddingOptions configures embedding generation
type EmbeddingResult ¶
type EmbeddingResult struct {
FileInfo *FileInfo
FileEmbedding []float32
LineEmbeddings [][]float32
ProcessingTime time.Duration
Error error
}
EmbeddingResult contains embeddings for a file
type EnhancedIgnoreFilter ¶
type EnhancedIgnoreFilter struct {
// contains filtered or unexported fields
}
EnhancedIgnoreFilter handles advanced file filtering
func NewEnhancedIgnoreFilter ¶
func NewEnhancedIgnoreFilter(baseDir string, options ...FilterOption) (*EnhancedIgnoreFilter, error)
NewEnhancedIgnoreFilter creates an enhanced ignore filter
func (*EnhancedIgnoreFilter) ShouldProcess ¶
func (f *EnhancedIgnoreFilter) ShouldProcess(path string) (bool, FileType)
ShouldProcess determines if a file should be processed
type FastIndexer ¶
type FastIndexer struct {
// contains filtered or unexported fields
}
FastIndexer provides high-performance parallel filesystem indexing
func NewFastIndexer ¶
func NewFastIndexer(config FastIndexerConfig) (*FastIndexer, error)
NewFastIndexer creates a new fast indexer
func (*FastIndexer) GetEngine ¶
func (fi *FastIndexer) GetEngine() *Int8SearchEngine
GetEngine returns the underlying search engine
func (*FastIndexer) IndexDirectory ¶
func (fi *FastIndexer) IndexDirectory(dir string, verbose bool) error
IndexDirectory indexes all files in a directory with parallel processing
func (*FastIndexer) Search ¶
func (fi *FastIndexer) Search(query string, topK int, threshold float32) ([]SearchMatch, error)
Search performs a search on the indexed content
func (*FastIndexer) Stats ¶
func (fi *FastIndexer) Stats() map[string]interface{}
Stats returns indexing statistics
type FastIndexerConfig ¶
FastIndexerConfig configures the fast indexer
func DefaultFastIndexerConfig ¶
func DefaultFastIndexerConfig() FastIndexerConfig
DefaultFastIndexerConfig returns sensible defaults
type FileEntry ¶
type FileEntry struct {
ID int `json:"id"`
Path string `json:"path"`
RelativePath string `json:"relative_path"`
Size int64 `json:"size"`
ModTime time.Time `json:"mod_time"`
LineCount int `json:"line_count"`
Language string `json:"language"`
Checksum uint32 `json:"checksum"`
// Line range in the global line index
LineStart int `json:"line_start"`
LineEnd int `json:"line_end"`
}
FileEntry represents metadata about an indexed file
type FileInfo ¶
type FileInfo struct {
Path string
Size int64
ModTime time.Time
IsText bool
LineCount int
Content string
RelativePath string
}
FileInfo represents a file discovered during crawling
type FileResultGroup ¶
type FileResultGroup struct {
FilePath string
Results []*SearchResult
}
FileResultGroup groups results by file
type FilterOption ¶
type FilterOption func(*EnhancedIgnoreFilter)
FilterOption configures the filter
func WithBinarySearch ¶
func WithBinarySearch(enable bool) FilterOption
WithBinarySearch enables binary file searching
func WithMaxFileSize ¶
func WithMaxFileSize(size int64) FilterOption
WithMaxFileSize sets max file size
type GPUChunkedSearcher ¶
type GPUChunkedSearcher struct {
// contains filtered or unexported fields
}
GPUChunkedSearcher uses GPU-accelerated semantic search with chunked output
func NewGPUChunkedSearcher ¶
func NewGPUChunkedSearcher() (*GPUChunkedSearcher, error)
NewGPUChunkedSearcher creates a new GPU-accelerated chunked searcher
func (*GPUChunkedSearcher) Close ¶
func (gcs *GPUChunkedSearcher) Close() error
Close releases resources
func (*GPUChunkedSearcher) SearchWithChunkedOutput ¶
func (gcs *GPUChunkedSearcher) SearchWithChunkedOutput(options BedSearchOptions) error
SearchWithChunkedOutput performs GPU-accelerated semantic search with chunked output
type GPUIndexData ¶
type GPUIndexData struct {
DeviceID int `json:"device_id"`
BatchSize int `json:"batch_size"`
MemoryUsage int64 `json:"memory_usage"`
CompressedData []byte `json:"compressed_data,omitempty"`
IndexType string `json:"index_type"` // "flat", "ivf", "hnsw"
SearchParameters []byte `json:"search_parameters,omitempty"`
}
GPUIndexData holds GPU-optimized index structures
type GitignoreRule ¶
type GitignoreRule struct {
// contains filtered or unexported fields
}
GitignoreRule represents a gitignore pattern
type HighlightRange ¶
type HighlightRange struct {
Start int `json:"start"`
End int `json:"end"`
Type string `json:"type"` // "match", "context", etc.
}
HighlightRange represents a range to highlight in search results
type IgnoreFilter ¶
type IgnoreFilter struct {
// contains filtered or unexported fields
}
IgnoreFilter handles .bedignore and .gitignore pattern matching
func NewIgnoreFilter ¶
func NewIgnoreFilter(basePath string, respectGitignore bool) (*IgnoreFilter, error)
NewIgnoreFilter creates a new ignore filter for the given directory
func (*IgnoreFilter) AddPattern ¶
func (f *IgnoreFilter) AddPattern(pattern string) error
AddPattern adds a custom ignore pattern
func (*IgnoreFilter) IsTextFile ¶
func (f *IgnoreFilter) IsTextFile(path string) bool
IsTextFile returns true if the file appears to be text-based
func (*IgnoreFilter) ShouldIgnore ¶
func (f *IgnoreFilter) ShouldIgnore(path string) bool
ShouldIgnore returns true if the given path should be ignored
type IndexConfig ¶
type IndexConfig struct {
MaxFileSize int64 `json:"max_file_size"`
IncludeExtensions []string `json:"include_extensions"`
ExcludeExtensions []string `json:"exclude_extensions"`
EmbeddingModel string `json:"embedding_model"`
UseGPU bool `json:"use_gpu"`
CompressionLevel int `json:"compression_level"`
LineBasedIndex bool `json:"line_based_index"`
ContextWindow int `json:"context_window"`
}
IndexConfig stores configuration used to build the index
type IndexOptions ¶
type IndexOptions struct {
Path string
Force bool
BatchSize int
UseGPU bool
Verbose bool
ShowProgress bool
MaxWorkers int
IncludeContent bool
LineLevel bool
FileLevel bool
WatchMode bool
}
IndexOptions configures the indexing process
func DefaultIndexOptions ¶
func DefaultIndexOptions() IndexOptions
DefaultIndexOptions returns sensible defaults
type IndexStatus ¶
type IndexStatus struct {
Exists bool `json:"exists"`
Path string `json:"path"`
Stats map[string]interface{} `json:"stats,omitempty"`
LastUpdated time.Time `json:"last_updated"`
IsUpToDate bool `json:"is_up_to_date"`
Size int64 `json:"size"`
}
IndexStatus provides information about the current index
func GetIndexStatus ¶
func GetIndexStatus() (*IndexStatus, error)
GetIndexStatus returns information about the current index
func (*IndexStatus) Display ¶
func (status *IndexStatus) Display() error
Display prints the index status in a readable format
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer handles building and maintaining the embedding index
func (*Indexer) EstimateIndexSize ¶
func (idx *Indexer) EstimateIndexSize(path string, options IndexOptions) (int64, error)
EstimateIndexSize estimates the disk space required for indexing
func (*Indexer) Index ¶
func (idx *Indexer) Index(options IndexOptions) error
Index builds or updates the semantic index
func (*Indexer) UpdateIndex ¶
func (idx *Indexer) UpdateIndex(changedFiles []string, options IndexOptions) error
UpdateIndex performs incremental index updates
type Int8SearchEngine ¶
type Int8SearchEngine = OptimizedSearchEngine
Int8SearchEngine is an alias for backwards compatibility
type LineEntry ¶
type LineEntry struct {
ID int `json:"id"`
FileID int `json:"file_id"`
LineNumber int `json:"line_number"`
Content string `json:"content"`
Embedding []float32 `json:"embedding,omitempty"` // Omitted for space in JSON
EmbeddingID int `json:"embedding_id"` // Index into LineEmbeddings
// Context for better search results
ContextBefore string `json:"context_before,omitempty"`
ContextAfter string `json:"context_after,omitempty"`
}
LineEntry represents an individual line with its embedding
type OptimizedSearchEngine ¶
type OptimizedSearchEngine struct {
// contains filtered or unexported fields
}
OptimizedSearchEngine provides SIMD-accelerated semantic search Pre-computes norms at index time for fastest search
func NewInt8SearchEngine ¶
func NewInt8SearchEngine() (*OptimizedSearchEngine, error)
NewInt8SearchEngine creates a new SIMD-accelerated search engine
func NewOptimizedSearchEngine ¶
func NewOptimizedSearchEngine() (*OptimizedSearchEngine, error)
NewOptimizedSearchEngine creates a new optimized search engine
func (*OptimizedSearchEngine) AddDocument ¶
func (e *OptimizedSearchEngine) AddDocument(doc Document, embedding *gobed.Int8Result512)
AddDocument adds a document with an int8 embedding
func (*OptimizedSearchEngine) AddDocumentFloat32 ¶
func (e *OptimizedSearchEngine) AddDocumentFloat32(doc Document, embedding []float32)
AddDocumentFloat32 adds a document with a float32 embedding
func (*OptimizedSearchEngine) BatchAddDocuments ¶
func (e *OptimizedSearchEngine) BatchAddDocuments(docs []Document, numWorkers int) error
BatchAddDocuments adds multiple documents efficiently
func (*OptimizedSearchEngine) Clear ¶
func (e *OptimizedSearchEngine) Clear()
Clear removes all documents from the index
func (*OptimizedSearchEngine) NumDocuments ¶
func (e *OptimizedSearchEngine) NumDocuments() int
NumDocuments returns the number of indexed documents
func (*OptimizedSearchEngine) Search ¶
func (e *OptimizedSearchEngine) Search(query string, topK int, threshold float32) ([]SearchMatch, error)
Search performs optimized parallel search
func (*OptimizedSearchEngine) UseInt8 ¶
func (e *OptimizedSearchEngine) UseInt8() bool
UseInt8 returns whether int8 mode is active
type OutputFormatter ¶
type OutputFormatter struct {
// contains filtered or unexported fields
}
OutputFormatter handles colorized output formatting like ripgrep
func NewOutputFormatter ¶
func NewOutputFormatter(colorMode string) *OutputFormatter
NewOutputFormatter creates a new formatter
func (*OutputFormatter) FormatError ¶
func (f *OutputFormatter) FormatError(err error) string
FormatError formats an error message
func (*OutputFormatter) FormatProgressBar ¶
func (f *OutputFormatter) FormatProgressBar(current, total int64, rate float64, eta string) string
FormatProgressBar formats a progress bar for indexing
func (*OutputFormatter) FormatSearchResults ¶
func (f *OutputFormatter) FormatSearchResults(results []*SearchResult, query string) string
FormatSearchResults formats search results like ripgrep
func (*OutputFormatter) FormatStatistics ¶
func (f *OutputFormatter) FormatStatistics(stats map[string]interface{}) string
FormatStatistics formats indexing/search statistics
func (*OutputFormatter) FormatSuccess ¶
func (f *OutputFormatter) FormatSuccess(message string) string
FormatSuccess formats a success message
func (*OutputFormatter) FormatWarning ¶
func (f *OutputFormatter) FormatWarning(message string) string
FormatWarning formats a warning message
func (*OutputFormatter) SetContextLines ¶
func (f *OutputFormatter) SetContextLines(lines int)
SetContextLines sets the number of context lines to show
func (*OutputFormatter) SetLineNumbers ¶
func (f *OutputFormatter) SetLineNumbers(show bool)
SetLineNumbers enables or disables line number display
type ProcessedQuery ¶
type ProcessedQuery struct {
Original string
Enhanced string
Terms []string
CodeTerms []string
Concepts []string
QueryType QueryType
Weights map[string]float32
}
ProcessedQuery represents an enhanced query with metadata
func (*ProcessedQuery) Format ¶
func (processed *ProcessedQuery) Format() string
Format formats the processed query for display
type QueryProcessor ¶
type QueryProcessor struct {
// contains filtered or unexported fields
}
QueryProcessor enhances natural language queries for better search results
func NewQueryProcessor ¶
func NewQueryProcessor() *QueryProcessor
NewQueryProcessor creates a new query processor
func (*QueryProcessor) GetSuggestions ¶
func (qp *QueryProcessor) GetSuggestions(partial string) []string
GetSuggestions provides query suggestions based on partial input
func (*QueryProcessor) Process ¶
func (qp *QueryProcessor) Process(query string) *ProcessedQuery
Process enhances a natural language query
func (*QueryProcessor) ReRank ¶
func (qp *QueryProcessor) ReRank(results []*SearchResult, processed *ProcessedQuery) []*SearchResult
ReRank re-ranks results based on query analysis
type SearchMatch ¶
SearchMatch represents a search result
type SearchOptions ¶
type SearchOptions struct {
Query string
Limit int
Context int
Threshold float32
NoIndex bool
ForceIndex bool
UseGPU bool
IgnoreCase bool
ColorMode string
Verbose bool
}
SearchOptions configures search behavior
type SearchResult ¶
type SearchResult struct {
FileID int `json:"file_id"`
FilePath string `json:"file_path"`
LineID int `json:"line_id"`
LineNumber int `json:"line_number"`
Content string `json:"content"`
Similarity float32 `json:"similarity"`
Distance float32 `json:"distance"`
// Context for display
ContextBefore string `json:"context_before"`
ContextAfter string `json:"context_after"`
// Highlighting information
Highlights []HighlightRange `json:"highlights,omitempty"`
}
SearchResult represents a single search result
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
Searcher handles semantic search operations
func NewSearcher ¶
NewSearcher creates a new searcher instance
func (*Searcher) Search ¶
func (s *Searcher) Search(options SearchOptions) error
Search performs semantic search
type SimpleBedSearcher ¶
type SimpleBedSearcher struct {
// contains filtered or unexported fields
}
SimpleBedSearcher uses SimpleSearchEngine for bed
func NewSimpleBedSearcher ¶
func NewSimpleBedSearcher() (*SimpleBedSearcher, error)
NewSimpleBedSearcher creates a bed searcher
func (*SimpleBedSearcher) Close ¶
func (sbs *SimpleBedSearcher) Close() error
Close releases resources
func (*SimpleBedSearcher) Search ¶
func (sbs *SimpleBedSearcher) Search(options BedSearchOptions) error
Search performs natural language search
type SimpleSearchEngine ¶
type SimpleSearchEngine struct {
// contains filtered or unexported fields
}
SimpleSearchEngine provides semantic search with gobed
func NewSimpleSearchEngine ¶
func NewSimpleSearchEngine() (*SimpleSearchEngine, error)
NewSimpleSearchEngine creates a new search engine
func (*SimpleSearchEngine) IndexDirectory ¶
func (se *SimpleSearchEngine) IndexDirectory(path string, options BedSearchOptions) error
IndexDirectory indexes all files in a directory
func (*SimpleSearchEngine) Search ¶
func (se *SimpleSearchEngine) Search(query string, limit int, threshold float32) ([]SearchMatch, error)
Search performs semantic search