Documentation
¶
Index ¶
- type DocSummary
- type ExcludeEntry
- type PageEntry
- type Store
- func (s *Store) AddExclude(dir, pattern string) (*ExcludeEntry, error)
- func (s *Store) DeleteAllByPrefix(dirPrefix string) error
- func (s *Store) DeleteByDoc(docPath string) error
- func (s *Store) DeleteExclude(excludeID string) error
- func (s *Store) GetByDoc(docPath string) ([]*PageEntry, error)
- func (s *Store) IsDocIndexed(docPath string) (bool, error)
- func (s *Store) ListDocPaths(dirPrefix string) ([]string, error)
- func (s *Store) ListDocsSummary(dirPrefix string) ([]*DocSummary, error)
- func (s *Store) ListDocxFiles(dirPrefix string) ([]*PageEntry, error)
- func (s *Store) ListExcludes(dir string) ([]*ExcludeEntry, error)
- func (s *Store) ListPDFFiles(dirPrefix string) ([]*PageEntry, error)
- func (s *Store) ListTextFiles(dirPrefix string) ([]*PageEntry, error)
- func (s *Store) SeedDefaultExcludes(dir string) error
- func (s *Store) UpdateLabels(docPath string, pageNum int, labels []string) error
- func (s *Store) Upsert(entry *PageEntry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocSummary ¶
type DocSummary struct {
DocPath string `json:"docPath"`
PageCount int `json:"pageCount"`
Pages []*PageEntry `json:"pages,omitempty"`
IndexedAt int64 `json:"indexedAt"`
}
DocSummary holds a document's metadata for the UI listing. Pages is only populated by callers that explicitly attach full page data; the docs listing leaves it empty to keep the payload small.
type ExcludeEntry ¶ added in v0.7.0
type ExcludeEntry struct {
ID string `json:"id"`
Directory string `json:"directory"`
Pattern string `json:"pattern"`
CreatedAt int64 `json:"createdAt"`
}
ExcludeEntry is a pattern that the indexer skips during a walk. Patterns are matched against directory names and file basenames. Glob wildcards (e.g. *.min.js) are supported via filepath.Match.
type PageEntry ¶
type PageEntry struct {
ID string `json:"id"`
DocPath string `json:"docPath"`
PageNum int `json:"pageNum"`
Keywords []string `json:"keywords"`
Labels []string `json:"labels"`
IndexedAt int64 `json:"indexedAt"`
}
PageEntry represents a single indexed page in a PDF document.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides persistence for doc_page_index entries.
func (*Store) AddExclude ¶ added in v0.7.0
func (s *Store) AddExclude(dir, pattern string) (*ExcludeEntry, error)
AddExclude inserts a new exclude pattern for a directory. Duplicate patterns are ignored.
func (*Store) DeleteAllByPrefix ¶
DeleteAllByPrefix deletes all entries for docs under dirPrefix (directory boundary semantics, see dirPrefixFilter).
func (*Store) DeleteByDoc ¶
DeleteByDoc removes all PageEntry rows for a given document path.
func (*Store) DeleteExclude ¶ added in v0.7.0
DeleteExclude removes an exclude entry by ID.
func (*Store) IsDocIndexed ¶ added in v0.7.0
IsDocIndexed reports whether any pages for the given document path exist in the index.
func (*Store) ListDocPaths ¶ added in v0.19.3
ListDocPaths returns the distinct doc_path values under dirPrefix (directory boundary semantics, see dirPrefixFilter). It is used by the indexer to detect stale entries for files that no longer exist on disk.
func (*Store) ListDocsSummary ¶
func (s *Store) ListDocsSummary(dirPrefix string) ([]*DocSummary, error)
ListDocsSummary returns one DocSummary per unique doc_path whose path is under dirPrefix. It aggregates in a single query and does not load per-page label data — callers that need full pages should use GetByDoc.
func (*Store) ListDocxFiles ¶ added in v0.13.6
ListDocxFiles returns all indexed DOCX entries (page-level) whose doc_path is under dirPrefix (directory-boundary semantics, see dirPrefixFilter), ordered by path then page number. Each DOCX document will have one entry per pseudo-page; callers group them by DocPath.
func (*Store) ListExcludes ¶ added in v0.7.0
func (s *Store) ListExcludes(dir string) ([]*ExcludeEntry, error)
ListExcludes returns all exclude patterns stored for the given directory.
func (*Store) ListPDFFiles ¶ added in v0.13.6
ListPDFFiles returns all indexed PDF entries (page-level) whose doc_path is under dirPrefix (directory-boundary semantics, see dirPrefixFilter), ordered by path then page number. Each PDF document will have one entry per page; callers group them by DocPath.
func (*Store) ListTextFiles ¶ added in v0.7.0
ListTextFiles returns all indexed non-PDF, non-DOCX entries whose doc_path is under dirPrefix (the boundary is the directory separator, so a sibling folder sharing the prefix never matches), ordered by path. Each text/code file has exactly one entry (page 1).
func (*Store) SeedDefaultExcludes ¶ added in v0.7.0
SeedDefaultExcludes inserts the default patterns for a directory if none exist yet.
func (*Store) UpdateLabels ¶
UpdateLabels updates only the labels field for a specific page.