search

package
v0.3.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package search provides full-text search using SQLite FTS5

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancedQuery

type AdvancedQuery struct {
	// Boolean operators
	AND []string
	OR  []string
	NOT []string

	// Phrase matching
	Phrases []string

	// Prefix matching
	Prefixes []string

	// Filters
	MinDate int64
	MaxDate int64
}

AdvancedQuery supports boolean operators and phrase matching

type Query

type Query struct {
	Query      string `json:"query"`
	Limit      int    `json:"limit"`
	Offset     int    `json:"offset"`
	TypeFilter string `json:"type_filter"` // "task", "output", "epic", or "all"
}

Query represents a search query

type Result

type Result struct {
	Type      string  `json:"type"` // "task", "output", "epic"
	ID        string  `json:"id"`
	Title     string  `json:"title"`
	Content   string  `json:"content"`
	Match     string  `json:"match"` // Highlighted match snippet
	Rank      float64 `json:"rank"`  // FTS5 rank score
	ProjectID string  `json:"project_id,omitempty"`
	TaskID    string  `json:"task_id,omitempty"`
	Timestamp int64   `json:"timestamp"`
}

Result represents a search result

type Searcher

type Searcher struct {
	// contains filtered or unexported fields
}

Searcher provides full-text search capabilities

func NewSearcher

func NewSearcher(dbPath string) (*Searcher, error)

NewSearcher creates a new searcher instance

func (*Searcher) BuildFTS5Query

func (s *Searcher) BuildFTS5Query(q *AdvancedQuery) string

BuildFTS5Query builds an FTS5 query from an AdvancedQuery

func (*Searcher) Close

func (s *Searcher) Close() error

Close closes the database connection

func (*Searcher) GetMatch

func (s *Searcher) GetMatch(resultType, id string) (string, error)

GetMatch returns the full content for a search result

func (*Searcher) IndexOutput

func (s *Searcher) IndexOutput(outputID, taskID, agentType, output string) error

IndexOutput indexes an agent output in the FTS5 table

func (*Searcher) IndexTask

func (s *Searcher) IndexTask(taskID, title, description string) error

IndexTask indexes a task in the FTS5 table

func (*Searcher) InitSchema

func (s *Searcher) InitSchema() error

InitSchema creates the FTS5 virtual tables

func (*Searcher) ParseAdvancedQuery

func (s *Searcher) ParseAdvancedQuery(queryStr string) (*AdvancedQuery, error)

ParseAdvancedQuery parses a complex search query with operators

func (*Searcher) Search

func (s *Searcher) Search(query Query) ([]*Result, error)

Search performs a full-text search with the given query

func (*Searcher) SetLogger

func (s *Searcher) SetLogger(logger *log.Logger)

SetLogger sets the logger for the searcher

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL