MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / scoreNote

Function scoreNote

packages/app-core/src/lib/note-search.ts:118–125  ·  view source on GitHub ↗
(entry: NoteSearchEntry, query: string, allowFuzzy = true)

Source from the content-addressed store, hash-verified

116}
117
118function scoreNote(entry: NoteSearchEntry, query: string, allowFuzzy = true): number {
119 return Math.max(
120 scorePreparedMatch(query, entry.titleLower, allowFuzzy) * 0.7,
121 scorePreparedMatch(query, entry.pathLower, allowFuzzy) * 0.25,
122 scorePreparedMatch(query, entry.excerptLower, allowFuzzy) * 0.2,
123 scorePreparedMatch(query, entry.tags, allowFuzzy) * 0.1
124 )
125}
126
127function insertTopMatch<T extends { score: number }>(
128 matches: T[],

Callers 1

searchNoteIndexFunction · 0.70

Calls 1

scorePreparedMatchFunction · 0.85

Tested by

no test coverage detected