Documentation
¶
Index ¶
- func AliasEntities(ctx context.Context, db *sql.DB, targetID string, aliases []ResolvedEntity) error
- func UnaliasEntity(ctx context.Context, db *sql.DB, aliasName string) error
- type AliasSuggestion
- type CatchupDelta
- type CooccurrenceNode
- type EntityGraph
- type EntityNode
- type PathStep
- type ProximityWarning
- type ResolvedEntity
- type SearchOptions
- type SearchResponse
- type SearchResult
- type Suggestion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AliasEntities ¶ added in v0.53.1
func AliasEntities(ctx context.Context, db *sql.DB, targetID string, aliases []ResolvedEntity) error
AliasEntities collapses one or more alias entities into a target canonical entity. It merges all relationships and session mentions in a single transaction and records the mapping in the registry.
Types ¶
type AliasSuggestion ¶ added in v0.53.1
func GetAliasSuggestions ¶ added in v0.53.1
func GetAliasSuggestions(ctx context.Context, db *sql.DB, threshold float64) ([]AliasSuggestion, error)
GetAliasSuggestions finds pairs of entities that frequently appear in the same sessions. It uses Jaccard similarity: intersection / union of sessions.
type CatchupDelta ¶
type CatchupDelta struct {
Since time.Time
Sessions []SearchResult
ClosedIssues []types.Issue
StateChanges []types.BranchState
}
func GetCatchupDelta ¶
type CooccurrenceNode ¶
func GetRelatedEntitiesByCooccurrence ¶
func GetRelatedEntitiesByCooccurrence(ctx context.Context, db *sql.DB, entityID string, limit int) ([]CooccurrenceNode, error)
GetRelatedEntitiesByCooccurrence finds entities that frequently appear in the same sessions
type EntityNode ¶
type ProximityWarning ¶
type ResolvedEntity ¶
func ResolveEntities ¶
func ResolveEntities(ctx context.Context, db *sql.DB, term string, limit int) ([]ResolvedEntity, error)
ResolveEntities finds entities matching the term using Hybrid FTS + LIKE logic. This ensures consistent behavior between "Search" and "Graph/Impact" commands.
type SearchOptions ¶
type SearchOptions struct {
Query string
Author string
CurrentBranch string
Limit int
Strict bool // If true, only BM25 on sessions, no expansion
TextOnly bool // If true, only BM25, no entity lookup
Preview bool // If true, show first 3 lines instead of snippet
Explain bool // If true, show score breakdown
}
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult
RelatedEntities []string
Strategy string // e.g. "exact", "hybrid", "fallback"
}
func HybridSearch ¶
func HybridSearch(ctx context.Context, db *sql.DB, opts SearchOptions) (SearchResponse, error)
type SearchResult ¶
type SearchResult struct {
ID string `json:"id"`
Title string `json:"title"`
Date string `json:"date"`
Narrative string `json:"narrative"` // Snippet or Preview
Score float64 `json:"score"`
Reason string `json:"reason"` // e.g. "text match", "entity:Modal"
// Explanation fields (for --explain)
BM25 float64 `json:"bm25"`
PhraseBonus float64 `json:"phrase_bonus"`
NearBonus float64 `json:"near_bonus"`
EntityBonus float64 `json:"entity_bonus"`
RecencyBonus float64 `json:"recency_bonus"`
IsLowConfidence bool `json:"is_low_confidence"`
// Lifecycle fields
LifecycleStatus types.LifecycleState `json:"lifecycle_status"`
StatusReason string `json:"status_reason"`
IsValidated bool `json:"is_validated"`
Branch string `json:"branch"`
Author string `json:"author"`
AuthorEmail string `json:"author_email"`
Agent string `json:"agent"`
}
type Suggestion ¶
type Suggestion struct {
Name string
Distance int // -1 if not applicable
Type string // "exact", "typo", "fuzzy"
}
func SuggestEntities ¶
SuggestEntities finds potential entity matches for a term that yielded no results. It uses fuzzy matching and Levenshtein distance for typo correction.