Documentation
¶
Index ¶
- type ContentIndex
- func (ci *ContentIndex) Clear() error
- func (ci *ContentIndex) Close() error
- func (ci *ContentIndex) DocumentCount() uint64
- func (ci *ContentIndex) GetFileContent(relativePath string) (string, bool)
- func (ci *ContentIndex) IndexFile(relativePath string, content string, language string) error
- func (ci *ContentIndex) RemoveFile(relativePath string)
- func (ci *ContentIndex) Search(options SearchOptions) ([]ContentSearchResult, int, error)
- type ContentSearchResult
- type FileIndex
- func (fi *FileIndex) AddFile(file *IndexedFile)
- func (fi *FileIndex) AllFiles() []*IndexedFile
- func (fi *FileIndex) Clear()
- func (fi *FileIndex) FileCount() int
- func (fi *FileIndex) GetFile(relativePath string) *IndexedFile
- func (fi *FileIndex) LanguageCounts() map[string]int
- func (fi *FileIndex) RemoveFile(relativePath string)
- func (fi *FileIndex) SearchByGlob(pattern string, maxResults int) ([]FileSearchResult, error)
- func (fi *FileIndex) TotalSizeBytes() int64
- type FileSearchResult
- type IndexedFile
- type LineMatch
- type SearchOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentIndex ¶
type ContentIndex struct {
// contains filtered or unexported fields
}
ContentIndex provides full-text search over file contents using Bleve in-memory index.
func NewContentIndex ¶
func NewContentIndex() (*ContentIndex, error)
NewContentIndex creates a new in-memory Bleve content index.
func (*ContentIndex) Clear ¶
func (ci *ContentIndex) Clear() error
Clear removes all documents and recreates the index.
func (*ContentIndex) DocumentCount ¶
func (ci *ContentIndex) DocumentCount() uint64
DocumentCount returns the number of documents in the Bleve index.
func (*ContentIndex) GetFileContent ¶
func (ci *ContentIndex) GetFileContent(relativePath string) (string, bool)
GetFileContent returns the raw content of an indexed file. Returns the content and true if found, or empty string and false if not indexed.
func (*ContentIndex) IndexFile ¶
func (ci *ContentIndex) IndexFile(relativePath string, content string, language string) error
IndexFile adds or updates a file's content in the search index.
func (*ContentIndex) RemoveFile ¶
func (ci *ContentIndex) RemoveFile(relativePath string)
RemoveFile removes a file from the search index.
func (*ContentIndex) Search ¶
func (ci *ContentIndex) Search(options SearchOptions) ([]ContentSearchResult, int, error)
Search performs a full-text search across all indexed files. Query format:
- Plain text: match query (word-level matching)
- "quoted text": phrase query (exact phrase match)
- /regex/: regexp query
type ContentSearchResult ¶
ContentSearchResult holds a search match within a file.
type FileIndex ¶
type FileIndex struct {
// contains filtered or unexported fields
}
FileIndex maintains an in-memory index of file paths for fast glob-based searching. It uses a map for O(1) path lookups and a sorted slice for glob iteration.
func NewFileIndex ¶
func NewFileIndex() *FileIndex
NewFileIndex creates a new empty file path index.
func (*FileIndex) AddFile ¶
func (fi *FileIndex) AddFile(file *IndexedFile)
AddFile adds or updates a file in the index.
func (*FileIndex) AllFiles ¶
func (fi *FileIndex) AllFiles() []*IndexedFile
AllFiles returns all indexed files in sorted order. Use with caution on large indexes.
func (*FileIndex) GetFile ¶
func (fi *FileIndex) GetFile(relativePath string) *IndexedFile
GetFile returns the IndexedFile for a given relative path, or nil if not found.
func (*FileIndex) LanguageCounts ¶
LanguageCounts returns a map of language -> file count for all indexed files.
func (*FileIndex) RemoveFile ¶
RemoveFile removes a file from the index by its relative path.
func (*FileIndex) SearchByGlob ¶
func (fi *FileIndex) SearchByGlob(pattern string, maxResults int) ([]FileSearchResult, error)
SearchByGlob returns files matching a doublestar glob pattern. The pattern is matched against relative paths (forward slashes).
func (*FileIndex) TotalSizeBytes ¶
TotalSizeBytes returns the total size of all indexed files.
type FileSearchResult ¶
type FileSearchResult struct {
File *IndexedFile
}
SearchResult holds a file match from a glob search.
type IndexedFile ¶
type IndexedFile struct {
Path string // Absolute file path
RelativePath string // Path relative to project root (forward slashes)
Language string // Detected programming language
SizeBytes int64 // File size in bytes
ModTime time.Time // Last modification time
LineCount int // Number of lines in the file
}
IndexedFile represents a file that has been indexed. Used by both the file path index and the content index.