Documentation
¶
Index ¶
- func IsTextFile(ext string) bool
- type Indexer
- func (idx *Indexer) IndexDocument(ctx context.Context, filePath string) error
- func (idx *Indexer) Progress() *ProgressTracker
- func (idx *Indexer) Run(ctx context.Context) error
- func (idx *Indexer) WithExcludes(patterns []string) *Indexer
- func (idx *Indexer) WithMaxConcurrent(n int) *Indexer
- func (idx *Indexer) WithMaxKeywordsBatch(n int) *Indexer
- func (idx *Indexer) WithModel(model string) *Indexer
- type PageCorpus
- type PageText
- type ProgressTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTextFile ¶ added in v0.7.0
IsTextFile reports whether ext (e.g. ".go") is a supported text/code extension.
Types ¶
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer scans a workspace directory for PDF and text/code files and runs the IndexAgent on batches of documents to produce semantic labels per page.
func (*Indexer) IndexDocument ¶
IndexDocument extracts text from a PDF or text/code file, builds keyword corpora, then runs the IndexAgent in batches to produce labels. This is the single-file entry point — it delegates to the batch infrastructure.
func (*Indexer) Progress ¶ added in v0.9.0
func (idx *Indexer) Progress() *ProgressTracker
Progress returns the progress tracker for external monitoring.
func (*Indexer) Run ¶
Run scans dir recursively for PDF and text/code files and indexes each one. It groups small text files into batches (Solution 1), runs batches in parallel (Solution 2), and publishes progress events (Solution 5).
func (*Indexer) WithExcludes ¶ added in v0.7.0
WithExcludes sets additional patterns to skip during the directory walk. Patterns are matched against directory names and file basenames using filepath.Match.
func (*Indexer) WithMaxConcurrent ¶ added in v0.9.0
WithMaxConcurrent sets the number of parallel indexing sessions.
func (*Indexer) WithMaxKeywordsBatch ¶ added in v0.9.0
WithMaxKeywordsBatch sets the maximum number of keywords per LLM batch.
type PageCorpus ¶
PageCorpus holds the deduplicated keyword corpus for a single PDF page.
func BuildCorpora ¶
func BuildCorpora(pages []PageText) []PageCorpus
BuildCorpora converts page texts to keyword corpora in parallel. Each corpus is deduplicated, lowercased, and stripped of stop words and non-alphabetic tokens.
type PageText ¶
PageText holds the raw extracted text for a single PDF page.
func ExtractPages ¶
ExtractPages reads all pages from the PDF at pdfPath in parallel and returns a slice of PageText sorted by page number.
func ExtractTextFile ¶ added in v0.7.0
ExtractTextFile reads a text or code file and returns it as a single PageText. HTML/XML/template files have tags stripped before keyword extraction.