Documentation
¶
Overview ¶
Package history manages selection frequency tracking with exponential decay
Index ¶
- type Entry
- type History
- func (h *History) CleanupOldEntries() int
- func (h *History) Clear()
- func (h *History) GetAllEntries() []Entry
- func (h *History) GetAllScores() map[string]int
- func (h *History) GetAllScoresForQuery(query string) map[string]int
- func (h *History) GetScore(item string) int
- func (h *History) GetScoreForQuery(query, item string) int
- func (h *History) LoadAsync() <-chan error
- func (h *History) RecordSelection(item string)
- func (h *History) RecordSelectionWithQuery(query, item string)
- func (h *History) Save() error
- func (h *History) Stats() (totalSelections int, uniqueItems int)
- type SelectionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct {
// contains filtered or unexported fields
}
History manages selection frequency tracking
func (*History) CleanupOldEntries ¶
CleanupOldEntries removes history entries older than maxAgeDays This helps keep the history file size manageable and removes stale data
func (*History) GetAllEntries ¶ added in v0.2.9
GetAllEntries returns all history entries sorted by score (highest first)
func (*History) GetAllScores ¶
GetAllScores returns a map of all items to their scores with exponential decay
func (*History) GetAllScoresForQuery ¶
GetAllScoresForQuery returns scores for all items, boosted by query-specific history with exponential decay
func (*History) GetScore ¶
GetScore returns the frequency score for an item with exponential decay Higher score = more frequently selected and more recent Entries older than 100 days return 0
func (*History) GetScoreForQuery ¶
GetScoreForQuery returns the score for an item considering query-specific history with exponential decay Query-specific selections get a significant boost (3x multiplier)
func (*History) LoadAsync ¶
LoadAsync loads history from disk asynchronously Returns a channel that will receive an error (or nil on success)
func (*History) RecordSelection ¶
RecordSelection records a selection of the given item
func (*History) RecordSelectionWithQuery ¶
RecordSelectionWithQuery records a selection with query context
type SelectionInfo ¶
type SelectionInfo struct {
LastUsed time.Time // Last time selected
Count int // Number of times selected
}
SelectionInfo tracks information about a selected item