search

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package search is the note-search scoring the app's search palette uses: exact and prefix matches first, then word starts, then substrings, then a fuzzy subsequence for short queries; `#tag` tokens narrow the set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fold

func Fold(s string) string

Fold lower-cases a string and strips diacritics, so "resume" finds "Résumé". Nonspacing marks (unicode category Mn) are what accents decompose into under NFD.

func Fuzzy

func Fuzzy(query, label string) float64

Fuzzy is a general-purpose scorer for palettes over arbitrary labels: exact, prefix, word-start, substring, then subsequence. 0 means no match.

func MatchPositions

func MatchPositions(query, label string) []int

MatchPositions reports which runes of label a query matches as an in-order subsequence, case- and accent-insensitively. It returns nil when the query does not match. Used to underline matches in pickers.

func Notes

func Notes(index []Entry, query string, limit int, quickFirst bool) []vault.NoteMeta

Notes runs a query over the index. With no free text the live notes come back in their given order, tag filters applied; quick notes first and most recent first when quickFirst is set.

Types

type Entry

type Entry struct {
	Note vault.NoteMeta
	// contains filtered or unexported fields
}

Entry is a note prepared for scoring.

func Index

func Index(notes []vault.NoteMeta) []Entry

Index prepares notes for repeated searches.

Jump to

Keyboard shortcuts

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