Documentation
¶
Overview ¶
Package search provides full-text search capabilities for knowledge graphs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IndexStats ¶
type IndexStats struct {
TotalDocs uint64 `json:"total_docs"`
IndexedAt string `json:"indexed_at,omitempty"`
IndexPath string `json:"index_path,omitempty"`
StorageSize int64 `json:"storage_size_bytes,omitempty"`
}
IndexStats provides statistics about the search index.
type IndexedNode ¶
type IndexedNode struct {
ID string `json:"id"`
Type string `json:"type"`
Label string `json:"label"`
Doc string `json:"doc"` // Docstring/description
Package string `json:"package"` // Package name
SourceFile string `json:"source_file"` // File path
Module string `json:"module"` // Module name
Signature string `json:"signature"` // Function/method signature
AllText string `json:"all_text"` // Combined searchable text
}
IndexedNode is the document type stored in bleve.
type SearchOptions ¶
type SearchOptions struct {
Limit int // Maximum results to return (default 20)
Offset int // Skip first N results
NodeTypes []string // Filter by node types (function, class, etc.)
FuzzyDist int // Fuzzy matching edit distance (0=exact, 1-2=fuzzy)
Highlight bool // Include highlighted fragments
}
SearchOptions configures search behavior.
type SearchOutput ¶
type SearchOutput struct {
Query string `json:"query"`
TotalHits uint64 `json:"total_hits"`
MaxScore float64 `json:"max_score"`
Results []*SearchResult `json:"results"`
Took string `json:"took"`
Facets map[string]any `json:"facets,omitempty"`
Truncated bool `json:"truncated,omitempty"`
IndexStats *IndexStats `json:"index_stats,omitempty"`
}
SearchOutput contains the full search response.
type SearchResult ¶
type SearchResult struct {
ID string `json:"id"`
Score float64 `json:"score"`
Type string `json:"type"`
Label string `json:"label,omitempty"`
Package string `json:"package,omitempty"`
SourceFile string `json:"source_file,omitempty"`
Snippet string `json:"snippet,omitempty"`
Fragments []string `json:"fragments,omitempty"`
}
SearchResult represents a single search hit.
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
Searcher provides full-text search over graph data.
func NewSearcher ¶
NewSearcher creates a new searcher, opening or creating the index.
func (*Searcher) IndexNodes ¶
IndexNodes adds nodes to the search index.
func (*Searcher) Search ¶
func (s *Searcher) Search(queryStr string, opts SearchOptions) (*SearchOutput, error)
Search performs a full-text search.
func (*Searcher) Stats ¶
func (s *Searcher) Stats() (*IndexStats, error)
Stats returns index statistics.
Click to show internal directories.
Click to hide internal directories.