(entry: NoteSearchEntry, query: string, allowFuzzy = true)
| 116 | } |
| 117 | |
| 118 | function 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 | |
| 127 | function insertTopMatch<T extends { score: number }>( |
| 128 | matches: T[], |
no test coverage detected