Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnauthorized indicates the caller is not authorized to access sessions in the requested workspace.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the SQLite database connection with connection synchronization.
func (*DB) Search ¶
func (d *DB) Search(ctx context.Context, params SearchParams) (*SearchResponse, error)
Search executes an FTS5 search query over the indexed session database.
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer manages incremental full-text indexing of sessions.
func NewIndexer ¶
NewIndexer creates a new session indexer.
func (*Indexer) IndexSession ¶
IndexSession indexes or updates a single session if modified.
func (*Indexer) RebuildIndex ¶
RebuildIndex drops all existing index tables and re-indexes all sessions from scratch.
type SearchMatch ¶
type SearchMatch struct {
SessionID string `json:"session_id"`
Workspace string `json:"workspace"`
Model string `json:"model,omitempty"`
Provider string `json:"provider,omitempty"`
Role string `json:"role"`
MsgIndex int `json:"msg_index"`
Snippet string `json:"snippet"`
Content string `json:"content"`
}
SearchMatch represents an individual matched message within a session.
type SearchParams ¶
type SearchParams struct {
CallerWorkspace string `json:"caller_workspace,omitempty"` // Enforces workspace authorization boundary
Workspace string `json:"workspace,omitempty"` // Filter by workspace path
SessionID string `json:"session_id,omitempty"` // Scope search to a specific session
Query string `json:"query"` // Full-text search term
Roles []string `json:"roles,omitempty"` // e.g. ["user", "assistant"]
Limit int `json:"limit,omitempty"` // Results page limit (default 10, max 50)
Offset int `json:"offset,omitempty"` // Pagination offset
MaxBytes int `json:"max_bytes,omitempty"` // Maximum total bytes of content to return (default 16 KiB)
}
SearchParams specifies filters and parameters for full-text session queries.
type SearchResponse ¶
type SearchResponse struct {
Matches []SearchMatch `json:"matches"`
TotalCount int `json:"total_count"`
HasMore bool `json:"has_more"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Query string `json:"query"`
}
SearchResponse represents the paginated search result.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service encapsulates database indexing and search capabilities.
func DefaultService ¶
DefaultService returns the process-wide session query service.
func NewService ¶
NewService creates a new SessionQuery service with the specified paths.
func (*Service) RebuildIndex ¶
RebuildIndex drops and rebuilds the full-text search index from scratch.
func (*Service) Search ¶
func (s *Service) Search(ctx context.Context, params SearchParams) (*SearchResponse, error)
Search runs a full-text search against the indexed sessions. Automatically ensures the index is synchronized first.