docindex

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 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 NewStore

func NewStore(database *db.DB) *Store

NewStore creates a new Store backed by the given database.

func (*Store) DeleteAllByPrefix

func (s *Store) DeleteAllByPrefix(dirPrefix string) error

DeleteAllByPrefix deletes all entries for docs whose path starts with dirPrefix.

func (*Store) DeleteByDoc

func (s *Store) DeleteByDoc(docPath string) error

DeleteByDoc removes all PageEntry rows for a given document path.

func (*Store) GetByDoc

func (s *Store) GetByDoc(docPath string) ([]*PageEntry, error)

GetByDoc returns all PageEntry rows for a given document path.

func (*Store) ListDocsSummary

func (s *Store) ListDocsSummary(dirPrefix string) ([]*DocSummary, error)

ListDocsSummary returns one DocSummary per unique doc_path whose path starts with 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) UpdateLabels

func (s *Store) UpdateLabels(docPath string, pageNum int, labels []string) error

UpdateLabels updates only the labels field for a specific page.

func (*Store) Upsert

func (s *Store) Upsert(entry *PageEntry) error

Upsert inserts or replaces a PageEntry in the database.

Jump to

Keyboard shortcuts

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