Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentTimestamp ¶
func CurrentTimestamp() int64
CurrentTimestamp returns the current Unix timestamp
Types ¶
type Config ¶
type Config struct {
// Word boundary bonus (match after /, -, _, ., space)
WordBoundaryBonus float64
// Consecutive match bonus
ConsecutiveBonus float64
// Prefix match bonus (match at start)
PrefixBonus float64
// CamelCase bonus (match at uppercase letter)
CamelCaseBonus float64
// Recency bonus settings
MaxRecencyBonus float64
// Current branch bonus (git mode only)
CurrentBranchBonus float64
}
Config holds configuration for the unified scoring algorithm
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default scoring configuration inspired by fzy and fzf algorithms
func (Config) ItemScore ¶
func (c Config) ItemScore(text string, fuzzyScore int, matchedIndexes []int, timestamp int64, isCurrent bool, now int64) float64
ItemScore calculates the total score for an item combining fuzzy match score, position bonuses, and recency
func (Config) MatchBonus ¶
MatchBonus calculates bonus score based on match positions using fzy/fzf-inspired algorithm
func (Config) RecencyBonus ¶
RecencyBonus calculates recency bonus using hyperbolic decay Formula: bonus = maxBonus / (1 + ageInHours) This strongly prioritizes recent items:
0h ago -> maxBonus, 1h -> maxBonus/2, 2h -> maxBonus/3, 24h -> maxBonus/25
Click to show internal directories.
Click to hide internal directories.