index

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const PropertySchemaVersion = "pinax.properties.v1"
View Source
const SchemaVersion = "pinax.index.v2"

Variables

View Source
var ErrStaleIndexEpoch = errors.New("stale index epoch")

Functions

func ExtractAssetRows added in v0.1.3

func ExtractAssetRows(notes []domain.Note) []domain.DatabaseRow

func ExtractBacklinkRows added in v0.1.3

func ExtractBacklinkRows(notes []domain.Note) []domain.DatabaseRow

func ExtractLinkRows added in v0.1.3

func ExtractLinkRows(notes []domain.Note) []domain.DatabaseRow

func ExtractProperties

func ExtractProperties(note domain.Note) map[string]domain.PropertyValue

func ExtractPropertyRows

func ExtractPropertyRows(notes []domain.Note) []domain.DatabaseRow

func ExtractRelationRows added in v0.1.3

func ExtractRelationRows(notes []domain.Note) []domain.DatabaseRow

func ExtractTaskRows added in v0.1.3

func ExtractTaskRows(notes []domain.Note) []domain.DatabaseRow

func InferPropertyDefinitions

func InferPropertyDefinitions(rows []domain.DatabaseRow) []domain.PropertyDefinition
func ListAssetLinks(root string) ([]AssetLinkRecord, Status, error)

func ListFolders

func ListFolders(root string) ([]FolderRecord, Status, error)

func ListVaultFiles

func ListVaultFiles(root string) ([]VaultFileRecord, Status, error)

func ReplaceAssetProjection

func ReplaceAssetProjection(root string, assets []domain.Asset) error

Types

type AssetLinkRecord

type AssetLinkRecord = model.AssetLinkRecord

type AssetRecord

type AssetRecord = model.AssetRecord

type AttachmentRecord

type AttachmentRecord = model.AttachmentRecord

type Counts

type Counts struct {
	Notes       int
	Tags        int
	Links       int
	Tokens      int
	Attachments int
	Dimensions  int
	Folders     int
}

func Rebuild

func Rebuild(root string, notes []domain.Note) (Counts, error)

type DimensionCountRecord

type DimensionCountRecord = model.DimensionCountRecord

type DoctorReport

type DoctorReport struct {
	Status Status         `json:"status"`
	Issues []Issue        `json:"issues"`
	Counts map[string]int `json:"counts"`
}

func Diagnose

func Diagnose(root string, notes []domain.Note) (DoctorReport, error)

type FolderRecord

type FolderRecord = model.FolderRecord

type IncrementalResult

type IncrementalResult struct {
	NotePath string
	Skipped  bool
	Parsed   int
	Indexed  int
}

func DeleteNote

func DeleteNote(root string, del NoteDelete) (IncrementalResult, error)

func UpdateNote

func UpdateNote(root string, update NoteUpdate) (IncrementalResult, error)

type IndexCoordinator

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

func NewIndexCoordinator

func NewIndexCoordinator(opts IndexCoordinatorOptions) *IndexCoordinator

func (*IndexCoordinator) BeginEpoch

func (c *IndexCoordinator) BeginEpoch() uint64

func (*IndexCoordinator) CommitWriteBatch

func (c *IndexCoordinator) CommitWriteBatch(ctx context.Context, batch IndexWriteBatch) error

func (*IndexCoordinator) Emit

func (c *IndexCoordinator) Emit(ctx context.Context, event IndexEvent) (IndexEvent, error)

func (*IndexCoordinator) ProcessReady

func (c *IndexCoordinator) ProcessReady(ctx context.Context, handle func(context.Context, IndexEvent) error) error

func (*IndexCoordinator) RuntimeFacts

func (c *IndexCoordinator) RuntimeFacts() map[string]string

type IndexCoordinatorOptions

type IndexCoordinatorOptions struct {
	QueueSize int
	Epoch     uint64
	Now       func() time.Time
}

type IndexEvent

type IndexEvent struct {
	Seq         uint64         `json:"seq"`
	Epoch       uint64         `json:"epoch"`
	Kind        IndexEventKind `json:"kind"`
	OldPath     string         `json:"old_path,omitempty"`
	Path        string         `json:"path,omitempty"`
	ContentHash string         `json:"content_hash,omitempty"`
	EmittedAt   time.Time      `json:"emitted_at"`
}

type IndexEventKind

type IndexEventKind string
const (
	IndexEventNoteChanged      IndexEventKind = "note_changed"
	IndexEventNoteMoved        IndexEventKind = "note_moved"
	IndexEventNoteDeleted      IndexEventKind = "note_deleted"
	IndexEventRebuildRequested IndexEventKind = "rebuild_requested"
)

type IndexMetaRecord

type IndexMetaRecord = model.IndexMetaRecord

type IndexWriteBatch

type IndexWriteBatch struct {
	Epoch  uint64
	Commit func(context.Context) error
}

type Issue

type Issue struct {
	Code     string   `json:"issue_code"`
	Severity string   `json:"severity"`
	Path     string   `json:"path,omitempty"`
	NoteID   string   `json:"note_id,omitempty"`
	Message  string   `json:"message"`
	Evidence []string `json:"evidence,omitempty"`
}

type LinkRecord

type LinkRecord = model.LinkRecord

func LinksByTargetObjectID added in v0.1.6

func LinksByTargetObjectID(root, objectID string) ([]LinkRecord, error)

type LookupRequest

type LookupRequest struct {
	Query string
	Scope string
	Kind  string
}

type LookupResult

type LookupResult struct {
	Status     Status                        `json:"status"`
	Candidates []domain.VaultObjectCandidate `json:"candidates"`
}

func Lookup

func Lookup(root string, req LookupRequest) (LookupResult, error)

type NoteDelete

type NoteDelete struct {
	Path string
}

type NoteRecord

type NoteRecord = model.NoteRecord

type NoteTextRecord

type NoteTextRecord = model.NoteTextRecord

type NoteUpdate

type NoteUpdate struct {
	OldPath      string
	Note         domain.Note
	ModifiedUnix int64
	Size         int64
}

type PromptAssetRecord added in v0.1.1

type PromptAssetRecord = model.PromptAssetRecord

type PromptAssetSourceRefRecord added in v0.1.1

type PromptAssetSourceRefRecord = model.PromptAssetSourceRefRecord

type PromptAssetVersionRecord added in v0.1.1

type PromptAssetVersionRecord = model.PromptAssetVersionRecord

type PromptUsageFeedbackRecord added in v0.1.1

type PromptUsageFeedbackRecord = model.PromptUsageFeedbackRecord

type PropertyDefinitionRecord

type PropertyDefinitionRecord = model.PropertyDefinitionRecord

type PropertyValueRecord

type PropertyValueRecord = model.PropertyValueRecord

type RefreshOptions

type RefreshOptions struct {
	BatchSize int `json:"batch_size,omitempty"`
}

type RefreshResult

type RefreshResult struct {
	Scanned        int      `json:"scanned"`
	Changed        int      `json:"changed"`
	Skipped        int      `json:"skipped"`
	Indexed        int      `json:"indexed"`
	Created        int      `json:"created"`
	Moved          int      `json:"moved"`
	Deleted        int      `json:"deleted"`
	Failed         int      `json:"failed"`
	Batches        int      `json:"batches"`
	DurationMillis int64    `json:"duration_ms"`
	IndexStatus    string   `json:"index_status"`
	FailedPaths    []string `json:"failed_paths,omitempty"`
}

func Refresh

func Refresh(root string, notes []domain.Note, opts RefreshOptions) (RefreshResult, error)

func RefreshChanged

func RefreshChanged(root string, notes []domain.Note, changed []domain.ChangedPath, opts RefreshOptions) (RefreshResult, error)

type RepairOperation

type RepairOperation struct {
	Kind   string `json:"kind"`
	Mode   string `json:"mode"`
	Risk   string `json:"risk"`
	Path   string `json:"path"`
	Reason string `json:"reason"`
}

type RepairPlan

type RepairPlan struct {
	Kind       string            `json:"kind"`
	DryRun     bool              `json:"dry_run"`
	Writes     bool              `json:"writes"`
	Operations []RepairOperation `json:"operations"`
}

type RepairResult

type RepairResult struct {
	Plan        RepairPlan `json:"plan"`
	IndexStatus string     `json:"index_status"`
	BackupPath  string     `json:"backup_path,omitempty"`
	Counts      Counts     `json:"counts,omitempty"`
}

type ResultItem

type ResultItem struct {
	Note            domain.Note `json:"note"`
	Score           int         `json:"score"`
	MatchedFields   []string    `json:"matched_fields"`
	Snippet         string      `json:"snippet"`
	LinkCount       int         `json:"link_count"`
	AttachmentCount int         `json:"attachment_count"`
}

type SearchRequest

type SearchRequest struct {
	Query         string
	Tags          []string
	Group         string
	Folder        string
	Kind          string
	Status        string
	CreatedAfter  string
	UpdatedAfter  string
	LinkTarget    string
	HasAttachment bool
	Limit         int
	Sort          string
}

type SearchResult

type SearchResult struct {
	Engine      string       `json:"engine"`
	IndexStatus string       `json:"index_status"`
	Total       int          `json:"total"`
	Returned    int          `json:"returned"`
	Results     []ResultItem `json:"results"`
}
func Search(root string, req SearchRequest) (SearchResult, error)

type SearchTokenRecord

type SearchTokenRecord = model.SearchTokenRecord

type Status

type Status struct {
	Status        string   `json:"status"`
	Path          string   `json:"path"`
	SchemaVersion string   `json:"schema_version,omitempty"`
	Notes         int      `json:"notes,omitempty"`
	Evidence      []string `json:"evidence,omitempty"`
}

func FindAsset

func FindAsset(root, ref string) (domain.Asset, Status, error)

func Init

func Init(root string) (Status, error)

func Inspect

func Inspect(root string, notes []domain.Note) (Status, error)

func ListAssets

func ListAssets(root string) ([]domain.Asset, Status, error)

type SyncResult

type SyncResult struct {
	Created int `json:"created"`
	Changed int `json:"changed"`
	Moved   int `json:"moved"`
	Deleted int `json:"deleted"`
	Skipped int `json:"skipped"`
	Failed  int `json:"failed"`
}

func Sync

func Sync(root string, notes []domain.Note) (SyncResult, error)

type TagRecord

type TagRecord = model.TagRecord

type TaskRecord added in v0.1.3

type TaskRecord = model.TaskRecord

type VaultFileRecord

type VaultFileRecord = model.VaultFileRecord

Directories

Path Synopsis
gormgen 为 internal/index 本地索引投影生成 GORM Gen 类型化 DAO。
gormgen 为 internal/index 本地索引投影生成 GORM Gen 类型化 DAO。
Package model 定义 internal/index 本地索引投影的全部 GORM 模型。
Package model 定义 internal/index 本地索引投影的全部 GORM 模型。

Jump to

Keyboard shortcuts

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