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 ¶
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 ¶
Fuzzy is a general-purpose scorer for palettes over arbitrary labels: exact, prefix, word-start, substring, then subsequence. 0 means no match.
func HidesTemplates ¶ added in v0.13.1
HidesTemplates reports whether a Search notes query leaves the template folder's notes out (ZenNotes/zennotes#1024). They are placeholders nobody is searching for, so they stay out until the query's free text starts with the folder's path and a slash (`Templates/meet`), case-insensitively, which is how a template is found to be edited. Mirrors queryNamesTemplateFolder in the desktop's note-search.ts.
func MatchPositions ¶
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, templateFolder string) []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. A templateFolder's notes are left out unless the query names the folder (HidesTemplates); "" leaves every note in.